1
我设法设置了一个简单的webmethod,我从jquery中调用并确信它返回...然后我在该方法上添加了参数,并将参数添加到jquery中,但它的错误与从jquery错误调用带参数的asp.net webmethod
Message":"Invalid JSON primitive: one.","StackTrace":"
我在我的webmethod签名是像这样
[WebMethod]
public static string GetDate(string one, string two)
{
return "yes";
}
和我的jQuery是这样的,我在做什么错?
$.ajax({
type: "POST",
url: "MyService.aspx/GetDate",
data: { one: "value", two: "value" },
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert(msg.d);
},
error: function(msg) {
alert('error');
}
});
数据: “{ '一': '值', '二': '值'}” 也将工作。 +1 – ichiban 2009-06-01 20:25:30