页面调用部分:
$('#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 "什么也没有"; }
我的网站地址:http://www.jixie.net