onSuccess and onFailure doesn't get fired

723 Views Asked by At

I have used onSuccess and onFailure in my PageMethod call. However neither of them gets called and the WebMethod doesn't get fired either.

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
}

When I remove them and send only the values to the WebMethod, it works:

PageMethods.LoginUser(email, pass);
//This fires the Web Method

I have enabled PageMethods in my ScriptManager as well. What am I doing wrong?

1

There are 1 best solutions below

1
On BEST ANSWER

You PageMethod is looking like this

PageMethods.LoginUser(onSuccess, onFailure, email, pass);

And when you call it, it looks like this

PageMethods.LoginUser(email, pass);

Your arguments should be in the same order as the method.

PageMethods.LoginUser(email, pass, onSuccess, onFailure);