Datasheet

Chapter 1: AJAX Technologies
9
{
var usernametbx = document.getElementById(“usernametbx”);
var passwordtbx = document.getElementById(“passwordtbx”);
var credentials1= new credentials(usernametbx.value, passwordtbx.value);
var body = serialize(credentials1);
request = new XMLHttpRequest();
request.open(“POST”, document.form1.action);
request.onreadystatechange = readyStateChangeCallback;
request.setRequestHeader(“MyCustomHeader”, “true”);
request.setRequestHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);
request.send(body);
}
</script>
</head>
<body>
<form id=”form1” runat=”server”>
<table id=”credentials”>
<tr>
<td align=”right” style=”font-weight: bold”>
Username:
</td>
<td align=”left”>
<asp:TextBox runat=”server” ID=”usernametbx” /></td>
</tr>
<tr>
<td align=”right” style=”font-weight: bold”>
Password:
</td>
<td align=”left”>
<asp:TextBox runat=”server” ID=”passwordtbx”
TextMode=”Password” />
</td>
</tr>
<tr>
<td align=”center” colspan=”2”>
<button id=”Button1” type=”button”
onclick=”submitCallback()”>Submit</button>
</td>
</tr>
</table>
<table id=”employeeinfo”
style=”background-color: LightGoldenrodYellow;
border-color: Tan; border-width: 1px;
color: Black; display: none” cellpadding=”2”>
<tr style=”background-color: Tan; font-weight: bold”>
<th colspan=”2”>
Your Information</th>
</tr>
<tr>
<td style=”font-weight: bold”>
First Name</td>
<td>
<span id=”firstname” />
</td>
(continued)
c01.indd 9c01.indd 9 8/20/07 5:40:06 PM8/20/07 5:40:06 PM