我正在从另一个下拉列表中填充drowpdown。第一次一切都很好,但是当我再次改变第一个下拉列表时,以前的值仍然显示在第二个下拉列表中。以下代码用于填充第二个下拉列表!jquery从其他下拉列表中下拉菜单
<select id="NextSession" name="NextSession">
<option value="1">Coffee</option>
<option value="2">Tea</option>
</select>
<select id="NextSectionId" name="NextSectionId">
<option><option>
</select>
$("#NextSession").blur(function() {
$("#NextSectionId").load("/GetData/" + $("#NextSession").val());
});
这里是我的PHP代码:
$UniqueId=$_GET['UniqueId'];
$query2="select ClassName,SectionName,SectionId from class,section where class.ClassId=section.ClassId and class.ClassStatus='Active' and section.SectionStatus='Active' and class.Session='$UniqueId' order by ClassName";
$check2=mysql_query($query2);
while($row2=mysql_fetch_array($check2))
{
$SelectClassName=$row2['ClassName'];
$SelectSectionName=$row2['SectionName'];
$SelectSectionId=$row2['SectionId'];
echo "<option value=\"$SelectSectionId\">$SelectClassName $SelectSectionName</option>";
}
请告诉我是什么问题!
这里是现场的例子!
myraipur.com/test/test.php
选择第一个下拉的任何选项,从第二个选择......然后去第一和第二下拉保持原样!
试着这样做: '$( “#NextSession”)变化(函数(){ $( “#NextSectionId”)。load(“/ GetData /”+ this.value); });' –
仍然面临同样的问题! –