Ajax login verification
The js file is as follows:
Var xmlHttp;
Function IMG1_onclick (){
CheckIsValid ();
}
Function CheckIsValid ()
{
CreatXmlHttpRequest ();
Var userName = document. getElementById ("AdminText ");
Var passWord = document. getElementById ("AdminPasswordText ");
Var url = "CheckLogin. aspx? UserName = "+ escape (userName. value) +" & passWord = "+ escape (passWord. value );
XmlHttp. open ("GET", url, true );
XmlHttp. onreadystatechange = callback;
XmlHttp. send (null );
}
Function CreatXmlHttpRequest ()
{
Try {
XmlHttp = new ActiveXObject ("Msxml2.XMLHTTP ");
} Catch (e ){
Try {
XmlHttp = new ActiveXObject ("Microsoft. XMLHTTP ");
} Catch (e2 ){
XmlHttp = false;
}
}
If (! XmlHttp & typeof XMLHttpRequest! = ''Undefined ''){
XmlHttp = new XMLHttpRequest ();
}
}
Function callback ()
{
If (xmlHttp. readyState = 4)
{
If (xmlHttp. status = 200)
{
Var mes = xmlHttp. responseXML. getElementsByTagName ("message") [0]. firstChild. data;
Var val = xmlHttp. responseXML. getElementsByTagName ("passed") [0]. firstChild. data;
SetMessage (mes, val );
}
}
} <