Bla*_*man 4 c# asp.net web-services asmx
如何传递服务端点参数?(本例中的页面大小)
我的.asmx服务方法如下:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<Object> GetData(int pageSize)
{
}
Run Code Online (Sandbox Code Playgroud)
当我通过jQuery调用它时:
$.ajax({
type: "POST",
url: "test.asmx/test123",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
},
error: function(msg) {
}
});
Run Code Online (Sandbox Code Playgroud)
你可以把它作为json传递:
$.ajax({
type: "POST",
url: "test.asmx/test123",
data: "{'pageSize':'14'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
},
error: function(msg) {
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2525 次 |
| 最近记录: |