日期:2014-05-16 浏览次数:20371 次
<span class="ssjt_span" style="width:30px;">省:</span> <select id="Province" onChange="loadCity();" style="float:left; width:100px;"> <OPTION value="-1">--省份--</OPTION> </select> <span class="ssjt_span" style="width:30px; float:left; padding-left:10px;">市:</span> <select id="City" style="float:left; width:150px;"> <OPTION value="-1">--城市--</OPTION> </select>
$.ajax({ url: "LoadCity.ashx", data: "ParentId="+ParentId+"&Now="+new Date().getTime(), dataType: "json", success: function (data) { $("#City").empty(); $.each(data, function (i) { if(i==0)$("<option value='" + data[i]["classid"] + "' selected='selected'>" + data[i]["classname"] + "</option>").appendTo("#City");else $("<option value='" + data[i]["classid"] + "'>" + data[i]["classname"] + "</option>").appendTo("#City"); }) }, error: function(msg) { window.location.reload(); } }); var CityName = $("#City").find("option:selected").text(); alert(CityName);输出的结果居然是"--城市--"