如何在jQuery上使用getJSON方法調用ASP.NET Web Form頁面上的方法?將jQuery的getJSON方法與ASP.NET Web表單一起使用
的目標是:
- 一個列表項用戶點擊
- 值發送到使用JSON
- 填充輔助服務器
- 服務器用的東西相關的列表來做出響應,格式化盒子
我不想使用UpdatePanel,我使用ASP.NET MVC框架完成了數百次,但不能使用Web窗體找出它!
到目前爲止,我可以做的一切,包括調用服務器,它只是不調用正確的方法。
感謝,
基隆
一些代碼:
jQuery(document).ready(function() {
jQuery("#<%= AreaListBox.ClientID %>").click(function() {
updateRegions(jQuery(this).val());
});
});
function updateRegions(areaId) {
jQuery.getJSON('/Locations.aspx/GetRegions',
{ areaId: areaId },
function (data, textStatus) {
debugger;
});
}