Home  >  Article  >  Web Front-end  >  Jquery加载时从后台读取数据绑定到dropdownList实例_jquery

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

WBOY
WBOYOriginal
2016-05-16 17:32:251251browse
复制代码 代码如下:

$(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);
}
});
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn