一个简单的对象:
$.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字段来确认行数
$.ajax({
type: "post",
url: "Handler.ashx",
dataType: "html",
data: { count:2,
people:[{ uid: "437", uname: "小1" },
{ uid: "123", uname: "小2"} ]
},
success: function (msg) {
alert(msg);
},
error: function () { alert(123) }
})
可用context.Request.Form["people[0][uid]"],context.Request.Form["people[0][uname]"]获取
var param = { insuranceName: "小小明"};
param.Name="小明";
可用context.Request.Form["customerParam[Name]"]或context.Request.Params["customerParam[Name]"]来获取;