Home >Web Front-end >JS Tutorial >When Jquery loads, read data from the background and bind it to the dropdownList instance_jquery

When Jquery loads, read data from the background and bind it to the dropdownList instance_jquery

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

$(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