Note that there are some explanatory texts on larger screens.

plurals
  1. POGet "Invalid web service call, missing value for parameter" error when calling a web service method using jQuery
    text
    copied!<p>This is my aspx file code:</p> <pre><code> 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) { } }); </code></pre> <p>This is my web service method:</p> <pre><code> [WebMethod,ScriptMethod(UseHttpGet=true)] public bool GetProductSubCategory(int productCategoryId) { //do some stuff return true; } </code></pre> <p>The problem is that the jQuery function fails with the following error:</p> <pre><code> {"Message":"Invalid web service call, missing value for parameter: \u0027productCategoryId\u0027.","StackTrace":" at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"} </code></pre> <p>By using Firebug, the URL jQuery requested was</p> <pre><code> http://192.168.1.100:8888/WebService/DsmWebServices.asmx/GetProductSubCategory?%27productCategoryId%27=%2710%27 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload