标签:jquery [] == bsp else err app content eva
‘ selected‘:‘‘)+">" + item.name + "</option>").appendTo($("#departmentId"));
});
}
});
$("#departmentId").click(function () {
loadDevice($("#departmentId").val());
});
function loadDevice(departmentId) {
$.ajax({
url: ‘dJson.action?
departmentId=‘ + departmentId,
type: ‘POST‘,
dataType: ‘JSON‘,
timeout: 5000,
error: function () { alert(‘载入数据异常,请重试!‘); },
success: function (msg) {
if (msg == "{[]}") {
$("#deviceId").empty();
$("<option value=‘0‘>查询全部</option>").appendTo($("#deviceId"));
} else {
$("#deviceId").empty();
$("<option value=‘0‘>查询全部</option>").appendTo($("#deviceId"));
$.each(eval(msg), function (i, item) {
$("<option value=‘" + item.deviceId + "‘" + (item.id == deviceId ?
‘ selected‘ : ‘‘) + ">" + item.name + "</option>").appendTo($("#deviceId"));
});
}
}
});
}
})
标签:jquery [] == bsp else err app content eva
原文地址:http://www.cnblogs.com/liguangsunls/p/6912774.html