DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript綜合知識 >> Jquery加載時從後台讀取數據綁定到dropdownList
Jquery加載時從後台讀取數據綁定到dropdownList
編輯:JavaScript綜合知識     

 代碼如下:

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