DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> jQuery入門知識 >> JQuery特效代碼 >> Jquery加載時從後台讀取數據綁定到dropdownList實例
Jquery加載時從後台讀取數據綁定到dropdownList實例
編輯:JQuery特效代碼     
. 代碼如下:
$(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);
}
});
}
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved