Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.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
Jquery WebMethod未启动_Jquery_Asp.net_Webforms - Fatal编程技术网

Jquery WebMethod未启动

Jquery WebMethod未启动,jquery,asp.net,webforms,Jquery,Asp.net,Webforms,问题: 激发showCurrentTime()时,永远不会调用WebMethod GetCurrentTime() 成功功能将触发并显示空警报 页面上有一个脚本管理器 JQuery是嵌入式的 尝试 url:''。同样的问题 尝试启用PageMethods,然后调用WebMethod,如下所示,并得到相同的问题 PageMethods.GetCurrentTime(onSuccess, onError); function onSuccess(resp) { al

问题:

激发showCurrentTime()时,永远不会调用WebMethod GetCurrentTime()

成功功能将触发并显示空警报


页面上有一个脚本管理器

JQuery是嵌入式的

尝试 url:''。同样的问题

尝试启用PageMethods,然后调用WebMethod,如下所示,并得到相同的问题

        PageMethods.GetCurrentTime(onSuccess, onError);
        function onSuccess(resp) { alert(resp.d); }
        function onError(resp) { alert(resp.d); }
谢谢你的帮助。谢谢

       function showCurrentTime() {

            $.ajax({
                type: "POST",
                url: "WebMethodTest2.aspx/GetCurrentTime",
                data: '{}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) { alert(response.d); },
                failure: function (response) { alert(response.d); }
            });

        }



如果其他任何人在没有意识到Asp.NET.FriendlyURL与此问题相关的情况下遇到此问题

在RouteConfig.cs中注释掉

  //settings.AutoRedirectMode = RedirectMode.Permanent;
在这里找到了答案:

  //settings.AutoRedirectMode = RedirectMode.Permanent;