$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/WebService/ProductGroupService.asmx/SaveProductGroup",
data: "{gArray:" + gArray+ ",QArray:" + QArray+ ",XArray:" + XArray+ ",PArray:" + PArray+ "}",
dataType: 'json',
success: function(data) {
alert("成功");
},
error: function(err) {
alert(err.responseText);
}
});
public bool SaveProductGroup(ArrayList gArray, ArrayList QArray, ArrayList XArray, ArrayList PArray)
{
Console.WriteLine(gArray[1]);
bool result = true;
return result;
}
data: "{gArray:" + gArray+ ",QArray:" + QArray+ ",XArray:" + XArray+ ",PArray:" + PArray+ "}",
这样写对么?
提示无效的web方法
------解决方案--------------------
data: gArray=gArray&QArray=QArray......
Try it.
而且,必须要返回JSON格式的数据才可以,否则会一直木有反应
------解决方案--------------------
亲,你这个URL可以访问么:/WebService/ProductGroupService.asmx/SaveProductGroup