JS-未定义Web服务

问题描述

aspx和asmx页面间的连接出现问题。

我的homepage.asmx是:

namespace TA.WebPage
{

    /// <summary>
    /// Summary description for WebService1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolBoxItem(false)]
    // To allow this Web Service to be called from script,using ASP.NET AJAX,uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class HomePage : WebService
    {

        [WebMethod]
        public A GetA()
        {
           return new A();
        }
    }
}

HomePageDesignaspx.aspx页面

  <head>
    <script type="text/javascript" language="javascript">
        function GetAObj() {
            TA.WebPage.HomePage.GetA(Success);
        }
    </script>
  </head>

    <body>
        <asp:ScriptManager ID="ScriptManager1">
            <Services>
                <asp:ServiceReference Path="HomePage.asmx" />
            </Services>

        </asp:ScriptManager>

    </body>

但是,当我单击按钮(onclick =“ GetAObj()”)时,此错误被接受:

Uncaught ReferenceError: TA is not defined
    at GetAObj(HomePageDesignaspx.aspx:25)
    at HTMLButtonElement.onclick (Home  
PageDesignaspx.aspx:164)

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)