亲宝软件园·资讯

展开

Jquery加载时从后台读取数据绑定到dropdownList实例

人气:0
复制代码 代码如下:

$(document).ready(function () {
loadSchools();
});
function loadSchools() {
var url = "@Url.Action("GetSchools")";
$.ajax({
url: url,
type: "GET",
dataType: "json",
error: function () {
alert("Error");
},
success: function (data) {
var items = "";
$.each(data, function (i, school) {
items += "<option value=\"" + school.SchoolId + "\">" + school.SchoolName + "</option>";
});
$("#SchoolId").html(items);
}
});
}

加载全部内容

相关教程
猜你喜欢
用户评论