【发布时间】:2015-08-27 09:06:53
【问题描述】:
当我在运行时向我的选择框添加数据时,我遇到了一个问题,页面从不自动刷新。我必须手动刷新页面才能让选择选择器填充新添加的选项值。
现在,当我单击选择器中的 ... 虚线按钮时,它会打开一个弹出窗口
如果我在此弹出窗口上添加值,它不会反映在我的选择器中。 请帮我。我要自动刷新选择框
编辑: 我的 JSP 代码:
<TD ALIGN="LEFT">
<fdms:speedselect name="firstCallInformation" property="placeDeath" category="LOCDEATH" column="1"
combo="true" maxlength="50" size="1" textsize="30">
<fdms:linkoption text="Edit list..." script="tableWindow2('LOCDEATH',1,'firstCallInformation.placeDeath')" />
<fdms:targetfield column="2" property="locationDeceased" />
<fdms:targetfield column="3" property="placeDeathCity" />
<fdms:targetfield column="6" property="placeDeathState" />
<fdms:targetfield column="7" property="placeDeathZip" />
<fdms:targetfield column="8" property="locDeathLicenseNumber" />
</fdms:speedselect>
</TD>
我正在使用某种 ajax 调用,但不确定它是否正确
function loadFacility(callback)
{
alert('In loadFacility');
var xmlhttp;
var keys=document.firstCallInformation.facilityselect.value;
var urls="localhost:8080/webfdms/showFirstCallInformation.do?vitalsId=366";
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status == 200)
{
//var some=xmlhttp.responseXML.documentElement;
var resposne = xmlhttp.responseText;
alert(resposne);
callback(xmlhttp.responseText);
}
}
xmlhttp.open("GET",urls,true);
xmlhttp.send(null);
}
function loadFacilityCallback(resposne){
if(resposne != null){
alert(resposne);
}
}
然后这样称呼它:
<fdms:speedselect property="facility" category="FacilityPlace" maxlength="50" column="1" combo="true" size="1" textsize="60" onchange="loadFacility(callback)">
【问题讨论】:
-
感谢您详细询问,能否在此处添加代码?
-
@TributetoAPJKalamSir 请查看我添加代码的编辑
标签: javascript jquery ajax drop-down-menu