The HTML code is as follows:
Loginvalidate.aspx
<%@ Page language= "C #" autoeventwireup= "true" codefile= "LoginValidate.aspx.cs" inherits= "Loginvalidate"%>
<title> Verify user name exists </title>
<script type= "Text/javascript" >
var xmlHttp;
function Createxmlhttprequest ()
{
if (window. ActiveXObject)
{
XmlHttp = new ActiveXObject ("Microsoft.XMLHTTP");
}
else if (window. XMLHttpRequest)
{
XmlHttp = new XMLHttpRequest ();
}
}
Processing methods
function Checkusername ()
{
Createxmlhttprequest ();
var url= "loginvalidate.ashx?username=" +document.getelementbyid ("username"). Value;
Xmlhttp.open ("Get", url,true);
Xmlhttp.onreadystatechange=showresult;
Xmlhttp.send (NULL);
document.getElementById ("MSG"). Innerhtml= ';
}
callback method
function Showresult ()
{
if (xmlhttp.readystate==4)
{
if (xmlhttp.status==200)
{
document.getElementById ("MSG"). Innerhtml=xmlhttp.responsetext;
}
}
}
</script>
<body>
<form id= "Form1" runat= "Server" >
<div>
<table style= "WIDTH:487PX" >
<tr>
<TD style= "width:70px" >
User name:</td>
<TD style= "width:231px" ><input id= "username" type= "text"/>
<input id= "Button1" type= "button" value= "button" onclick= "Checkusername ();"/></td>
<TD id= "MSG" ></td>
</tr>
<tr>
<TD style= "width:70px" >
</td>
<TD style= "width:231px" >
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>