PageMethods of ASP.NET AJAX are used to call server side code in client side code. PageMethods are implemented in code behind file. These are public static methods and are annoted with [WebMethod] attribute.
Example:
[WebMethod]
public static string function1(string param1)
{
return "success";
}
These page methods are renderd as inline javascript and called by a client side code.
Call function1 using PageMethods in javascript file.
PageMethods.function1("param1",OnSuccess,OnFail);
function OnSuccess(val)
{
//fetch returned value on success.
alert("Succcessfully done.");
return true;
}
function OnFail()
{
alert("Some error occurred during called page method: function1.");
return false;
}