在asmx服务文件中创建方法并获取错误? [英] Create a method in asmx service file and getting error?

查看:98
本文介绍了在asmx服务文件中创建方法并获取错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的错误是:

Hi,

My Error is:

Microsoft JScript runtime error: Unable to get value of the property '_staticInstance': object is null or undefined.







我的asmx服务代码:




My asmx service code:

[WebMethod]
       public string RedirectToLogin(string UserControl, string language, string country, string steps)
       {
           string redirectpage = string.Empty;
           Langauge.RequestRedirectPage Rp = new Langauge.RequestRedirectPage();
           redirectpage = Rp.getRedirectPage(UserControl, language, country, steps);
           return redirectpage.ToString();
       }







我的Javascript代码:






My Javascript code:

function load123() {
        Namespace1.RedirectToLogin("Registration", "dk", "denmark", "step2", onSuccess123, onfailedfun);
    }


function onSuccess123(resul) {
    window.location = resul;
    }
    function onfailedfun(res) {
    }





服务从aspx页面调用:< br $>




service calling from aspx page:

<asp:ScriptManager ID="ScriptManager2" runat="server">
           <Services>
               <asp:ServiceReference Path="~/Shop.asmx" />
           </Services>
       </asp:ScriptManager>





从JSDebug获取运行时[动态]页面:



Runtime getting from JSDebug[dynamic] page:

Shop._staticInstance.RedirectToLogin(UserControl,language,country,steps,onSuccess,onFailed,userContext); }





提前感谢。



thanks in advance.

推荐答案

通常如果你打电话的话要在jquery中使用asmx的方法,它应该是静态方法。
Usually if you are calling a method from asmx to be used in jquery it should be static method.


使方法RedirectToLogin像
Make the method RedirectToLogin as static like
public static string RedirectToLogin(string UserControl, string language, string country, string steps)


这篇关于在asmx服务文件中创建方法并获取错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆