script code
function CallPageMethod()
{
debugger;
PageMethods.MyFirstPageMethod(onSucceeded,onFailed);
}
function CallParametersPageMethod()
{
debugger;
PageMethods.MyFirstParameterPageMethod("This is a Demo",onSucceeded,onFailed);
}
function onSucceeded(result,userContext,methodName)
{
function CallPageMethod()
{;
$get('div1').innerText=result;
}
function onFailed(error,user)
{
debugger;
alert("An error occurred");
}
code behind code
[System.Web.Services.WebMethod()]
public static string MyFirstPageMethod()
{
return "Welcome to Ajaax";
}
[System.Web.Services.WebMethod()]
public static string MyFirstParameterPageMethod(string sVal)
{
return "Welcome To ajax world value passed is" + sVal ;
}