这是我的编号:
var DTO = { " productCategoryId ": " 10 " };
$.ajax({
type: "GET",
url: "/WebService/DsmWebServices.asmx/GetProductSubCategory",
data: DTO,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
window.alert("success");
},
error: function (msg) {
}
});
这是我的网络服务方法:
[WebMethod,ScriptMethod(UseHttpGet=true)]
public bool GetProductSubCategory(int productCategoryId)
{
//do some stuff
return true;
}
问题是, j功能因以下错误而失效:
{"Message":"Invalid web service call, missing value for parameter:
u0027productCategoryIdu0027.","StackTrace":" at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters)
at
System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)
at
System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)
at
System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}
通过使用火力,请求的URL jQuery
http://192.168.1.100:8888/WebService/DsmWebServices.asmx/GetProductSubCategory?%27productCategoryId%27=%2710%27