Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net Sitecore中的jQuery ajax帖子重复了方法名称_Asp.net_Jquery_Sitecore_Webmethod - Fatal编程技术网

Asp.net Sitecore中的jQuery ajax帖子重复了方法名称

Asp.net Sitecore中的jQuery ajax帖子重复了方法名称,asp.net,jquery,sitecore,webmethod,Asp.net,Jquery,Sitecore,Webmethod,我有一个ASMX服务,位于Website\sitecore\shell\WebService\Validate.ASMX [System.Web.Script.Services.ScriptService] 公共类验证:System.Web.Services.WebService { [WebMethod(true)] [ScriptMethod(ResponseFormat=ResponseFormat.Json,XmlSerializeString=false)] public Person

我有一个
ASMX
服务,位于
Website\sitecore\shell\WebService\Validate.ASMX

[System.Web.Script.Services.ScriptService]
公共类验证:System.Web.Services.WebService
{
[WebMethod(true)]
[ScriptMethod(ResponseFormat=ResponseFormat.Json,XmlSerializeString=false)]
public PersonValidationResult ValidateNaturalPerson(字符串主键)
{
var valResult=PROC.ODSHelper.ValidateNaturalPerson(pk);
返回结果;
}
}
我正在尝试调用textbox blur上的ValidateNaturalPerson方法:

 pkRegNum = $("#txtPerson").val();
 var options = {
                type: "POST",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                url: '/sitecore/shell/webservice/validate.asmx/ValidateNaturalPerson', 
                data: '{"pk":"'+pkRegNum+'"}',
                success: function (response) {
                    HandleNaturalPersonResponse(response.d, source, pkRegNum);
                },
                error: function (a, b, c) {
                    alert('error'); 
                }
            };
            $.ajax(options);
非常简单的东西。然而,在POST上,我不断收到HTTP 500错误。当我检查Firebug中的响应时,它显示:

[ArgumentException: Unknown web method ValidateNaturalPerson/ValidateNaturalPerson.
Parameter name: methodName]
   System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName) +758655
   System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +89
有什么想法是ValidateNaturalPerson/ValidateNaturalPerson的来源吗?
我假设是站点核心在处理请求。我尝试在发送事件之前在ajax中更改URL,尝试了各种
ScriptMethod
/
WebMethod
POST
/
GET
组合,但没有运气…

如果您认为Sitecore正在干扰您的请求,您可以告诉Sitecore忽略此请求,因此Sitecore不会干预。您可以通过将已添加的页面添加到解决方案的web.config中的“IgnoreUrlPrefix”设置来完成此操作。如果我错了,请纠正我,但这可能会起作用。

如果您认为Sitecore干扰了您的请求,您可以告诉Sitecore忽略此请求,这样Sitecore就不会干预。您可以通过将已添加的页面添加到解决方案的web.config中的“IgnoreUrlPrefix”设置来完成此操作。如果我错了,请纠正我,但这可能会起作用。

看起来像是在无法使页面方法保持静态时通常会出现的错误。在本例中为“ValidateNaturalPerson”。考虑到这不是一个页面方法,我不知道为什么它会在这里应用


看起来像是在无法使页面方法保持静态时通常会出现的错误。在本例中为“ValidateNaturalPerson”。考虑到这不是一个页面方法,我不知道为什么它会在这里应用