我用的还是传统的asp.net网页编程,前台用的JQuery,后台是asmx的webservice,我发现同样是ajax,get和post,同样的 dataType: "json", contentType: "application/json", data的写法是不一样的一个要序列化JSON.stringify(XXX:XX)一个不要,为什么呢?
type: 'get',
url: "Controllers/PathWebservice.asmx/GetMenuById",
dataType: "json",
data: { userId: userId },
contentType: "application/json",
type: "POST",
dataType: "json",
contentType: "application/json",
url: "../Controllers/FastreportWebService.asmx/getDimensions",
关键看你的web service接口怎么要求的,它需要什么格式的json参数。json的结构是什么,这个你可以和web service的开发/提供者联系。
webservice 接口一样的,都是我自己写的,所以我很纳闷,不知道是不是自己什么地方写错了