熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

Jquery加載時從後台讀取數據綁定到dropdownList

2022-06-13   來源: JSP教程 

  代碼如下:

$(document)ready(function () {  loadSchools();  });  function loadSchools() {  var url = "@UrlAction("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="" + schoolSchoolId + "">" + schoolSchoolName + "</option>";  });  $("#SchoolId")html(items);  }  });  }     
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20002.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.