onSuccess 和 onFailure 不会被触发
onSuccess and onFailure doesn't get fired
我在 PageMethod 调用中使用了 onSuccess 和 onFailure。然而,它们都没有被调用,WebMethod 也没有被触发。
alert("1");
PageMethods.LoginUser(onSuccess, onFailure, email, pass);
alert("2");
function onSuccess(val)
{
}
function onFailure()
{
}
[WebMethod(EnableSession = true)]
public static int LoginUser(string email, string pass)
{
//Doesn't get fired
}
当我删除它们并仅将值发送到 WebMethod 时,它起作用了:
PageMethods.LoginUser(email, pass);
//This fires the Web Method
我也在我的 ScriptManager 中启用了 PageMethods。我做错了什么?
您的 PageMethod 看起来像这样
PageMethods.LoginUser(onSuccess, onFailure, email, pass);
当你调用它时,它看起来像这样
PageMethods.LoginUser(email, pass);
您的参数应该与方法的顺序相同。
PageMethods.LoginUser(email, pass, onSuccess, onFailure);
我在 PageMethod 调用中使用了 onSuccess 和 onFailure。然而,它们都没有被调用,WebMethod 也没有被触发。
alert("1");
PageMethods.LoginUser(onSuccess, onFailure, email, pass);
alert("2");
function onSuccess(val)
{
}
function onFailure()
{
}
[WebMethod(EnableSession = true)]
public static int LoginUser(string email, string pass)
{
//Doesn't get fired
}
当我删除它们并仅将值发送到 WebMethod 时,它起作用了:
PageMethods.LoginUser(email, pass);
//This fires the Web Method
我也在我的 ScriptManager 中启用了 PageMethods。我做错了什么?
您的 PageMethod 看起来像这样
PageMethods.LoginUser(onSuccess, onFailure, email, pass);
当你调用它时,它看起来像这样
PageMethods.LoginUser(email, pass);
您的参数应该与方法的顺序相同。
PageMethods.LoginUser(email, pass, onSuccess, onFailure);