html
js
<tr>
<td class="zi" height="30">道路名称:</td>
<td class="shuru" height="30">
<select id="select_road" name="select_road" onchange="setRoadNum();">
</select>
</td>
</tr>
js
getRoadByOrg("1","#select_road");
var roadName = $("#select_road").find("option:selected").text();
var roadCode = $("#groupInfoRoadCode").val();
function getRoadByOrg(flag,tag,func){
var orgcode = $("#select_orgName").val();
if(orgcode!=null){
orgcode = $("#select_orgName").val().replace("site","");
}
var opts = {
cmd : "queryRoadbyOrg",
roadByOrganization : {
flag : flag,
SUBC_ID : orgcode
}
};
$.ajax({
url:"../../meltSnow",
data: $.toJSON(opts),
type:"post",
dataType:"json",
success:function(data) {
var result = data.result;
var reason = data.reason;
if("OK"==result){
var seleceTag = $(tag);
seleceTag.empty();
seleceTag.append($("<option>").text("--全部--").val(""));
if(data.roadByOrganizationList!=null){
if(data.roadByOrganizationList.length>0){
for(var i=0;i<data.roadByOrganizationList.length;i++){
var option = $("<option>").text(data.roadByOrganizationList[i].ROAD_NAME).val(data.roadByOrganizationList[i].ROAD_CODE);
seleceTag.append(option);
if(typeof(func)=="function"){
func();
}
}
}
}
}else{
alert(reason);
}
},
error:function(msg){
alert(msg);
}
});
}