頁面調用部分:
$('#btn').click(function () { $.ajax({ type: 'post', url: './GridTable.aspx/call', contentType: "application/json; charset=utf-8", data: '{"userinfo":[{"name":"zs","age":"21"},{"name":"ls","age":"25"}]}', dataType: 'json', success: function (result) { alert(result.d); } }); return false;});後台調用部分,兩種方法均可
[WebMethod]public static string call(Dictionary<string,string>[] userinfo){ System.Threading.Thread.Sleep(5000); return str[0]["name"];}[WebMethod]public static string test(List<UserinfoEntity> userinfos) { System.Threading.Thread.Sleep(5000); foreach (UserinfoEntity userinfo in userinfos) { return order.rowid; } return "什麼也沒有";}
頁面調用部分:
$('#btn').click(function () { $.ajax({ type: 'post', url: './GridTable.aspx/call', contentType: "application/json; charset=utf-8", data: '{"userinfo":[{"name":"zs","age":"21"},{"name":"ls","age":"25"}]}', dataType: 'json', success: function (result) { alert(result.d); } }); return false;});後台調用部分,兩種方法均可
[WebMethod]public static string call(Dictionary<string,string>[] userinfo){ System.Threading.Thread.Sleep(5000); return str[0]["name"];}[WebMethod]public static string test(List<UserinfoEntity> userinfos) { System.Threading.Thread.Sleep(5000); foreach (UserinfoEntity userinfo in userinfos) { return order.rowid; } return "什麼也沒有";}