Saturday, August 25, 2007

Ajax Service Method

1. Create web service with [System.Web.Script.Services.ScriptService()] attribute in class level

2. add Service Reference... in service manager
asp:ServiceReference Path="MyAjaxService.asmx"


3. Add javascript method

function Bt1_OnClick()
{
MyAjaxService.SayHello("Kurniawan",OnComplete,OnError);
}

function OnComplete(result)
{
alert("OnComplete : " + result);
}


function OnError(result)
{
alert("OnError : " + result._message);
}

No comments: