从JavaScript调用WebMethod失败
WebMethod call from JavaScript fails.
我有以下类
namespace UI
{
/// <summary>
/// Summary description for Registration1
/// </summary>
[WebService(Namespace = "UI")]
[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 Registration1 : System.Web.Services.WebService
{
[WebMethod]
public static string RegisterUser(string sFirstName)
{
return "hello";
}
}
在客户端,我添加了我的JavaScript,
UI.Registration.RegisterUser(txtFirstName.get_value(),Register_success, onFailed);
在Script Manger 中
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
<Services>
<asp:ServiceReference Path="~/Registration.asmx" />
</Services>
</telerik:RadScriptManager>
但是,当我运行它时,它仍然看不到UI命名空间,并且我得到了一个JavaScript运行时错误。
您的类名为Registration1,但您正在调用名为Regeneration的类上的方法。
相关文章:
- 当json解析空响应时,Whatwg-Fetch失败,我该如何防止它
- JsFiddle在分叉后描述失败
- 为什么不'当单元测试出现解析错误时,我的因果报应测试会失败
- 当一些承诺失败时,如何继续使用$q.all()
- 失败:等待Protractor与页面同步时出错:“”;在窗口上找不到角度”;
- 在Jquery中单击传播失败
- 网页上失败的javascript会导致所有其他脚本失败
- 带有对象解析的响应javascript ajax失败
- 一台特定计算机的Ajax请求数据未定义/失败
- Nodejs服务器:加载资源失败:服务器的响应状态为404(未找到)
- jQuery.getJSON失败,语法错误
- ng disabled在放入多个表达式时失败
- Jasmine单元测试在监视服务方法时失败
- jQuery分页下一页和上一页按钮在点击零或超过最后一页后失败
- 在iframe的情况下,jQuery html()将失败
- 在我的情况下,使用带有变量失败的 jquery 选择器
- WebMethod在ASP.Net Web角色(Web窗体)中不起作用
- CSS中的转换似乎失败了,原因是什么
- 将变量从jQuery传递到WebMethod(身份验证失败)
- 从JavaScript调用WebMethod失败