一个简单的对象:
$.ajax({ type: "post", url: "Handler.ashx", dataType: "html", data: { uid: "437", uname: "%u6211%u884C%u5BA2%u670D" }, success: function (msg) { alert(msg); }, error: function () { alert(123) } })
可以使用 context.Request.Form["uid"]、context.Request.Form["uname"]来获取对象的两个字段。
数组:如果传递的是数组,应该传递一个count字段来确认行数
1 $.ajax({ 2 type: "post", 3 url: "Handler.ashx", 4 dataType: "html", 5 data: { count:2, 6 people:[{ uid: "437", uname: "小1" }, 7 { uid: "123", uname: "小2"} ] 8 }, 9 success: function (msg) { 10 alert(msg); 11 }, 12 error: function () { alert(123) } 13 })
可用context.Request.Form["people[0][uid]"],context.Request.Form["people[0][uname]"]获取
1 var param = { insuranceName: "小小明"}; 2 param.Name="小明";
可用context.Request.Form["customerParam[Name]"]或context.Request.Params["customerParam[Name]"]来获取;