English 中文(简体)
• 在使用j Query的网络服务方法时,寻找“因公而丧失价值”错误
原标题:Get "Invalid web service call, missing value for parameter" error when calling a web service method using jQuery

这是我的编号:


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
问题回答

你们必须用“职位”来形容你的神职。 此外,提供给你的网络服务机构的数据需要是一种 j笑。 无 j子物体。 探讨json2图书馆的强化方法:

rel=“nofollow noreferer”> http://www.json.org/js.html

在其他错误信息中,我收到了同样的信息。 由于我最后使用员额,我想把读者点到我的其他回答:Calling Webservice with Jquery causesing thewoe





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签