Jquery加载时从后台读取数据绑定到dropdownList实例_jquery
程序员文章站
2022-03-26 20:16:00
...
复制代码 代码如下:
$(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 += "";
});
$("#SchoolId").html(items);
}
});
}
下一篇: php如何防止表单重复提交