Tuesday, October 23, 2007

Ajax (2)


<asp:ScriptManager ID="ScriptManager1" runat="server">

<Services>

<asp:ServiceReference Path="EmployeeService.asmx" />

</Services>

</asp:ScriptManager>

<script language="javascript" type="text/javascript">

function showEmployee(firstName, lastName, title)

{

AspNetAjaxOverview.EmployeeService.GetEmployee(

firstName,

lastName,

title,

onGetEmployeeSuccess);

}

function onGetEmployeeSuccess(employee)

{

alert(String.format(

"Hello I'm {0} {1}, my title is '{2}'",

employee.FirstName,

employee.LastName,

employee.Title));

}

</script>

<input type="button" value="Bill Gates"

onclick="showEmployee('Bill', 'Gates', 'Chair man')" />

<input type="button" value="Steve Ballmer"

onclick="showEmployee('Steve', 'Ballmer', 'CEO')" />

blog comments powered by Disqus