<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title>ASP.NET AJAX</title>

  <script language="Javascript" type="text/javascript">
  function callService(f) {
    WebService.sayHello(
      f.elements["name"].value,
      callComplete,
      callTimeout,
      callError);
  }

  function callComplete(result) {
    window.alert(result);
  }
  function callTimeout(result) {
    window.alert("Error! " + result);
  }
  function callError(result) {
    window.alert("Error! " + result);
  }
  </script>

</head>
<body>
  <form id="form1" runat="server">
    <asp:ScriptManager 
 ID="ScriptManager1"
runat="server">
      <Services>
        <asp:ServiceReference Path="WebService.asmx" />
      </Services>
    </asp:ScriptManager>
    <div>
      <input type="text" id="name" name="name" />
      <input type="button" value="Call Service" onclick="callService(this.form);" />
    </div>
  </form>

</body>
</html>

