Example of partial refresh registration verification for phpajax
// JavaScript Document
- Var xmlHttp;
- Function S_xmlhttprequest ()
- {
- XmlHttp = null;
- If (window. XMLHttpRequest)
- {// Code for IE7, Firefox, Opera, etc.
- XmlHttp = new XMLHttpRequest ();
- }
- Else if (window. ActiveXObject)
- {// Code for IE6, IE5
- XmlHttp = new ActiveXObject ("Microsoft. XMLHTTP ");
- }
- }
Function getName (name)
- {
If (name = document. myform. name. value)
- {
- S_xmlhttprequest ();
- XmlHttp. open ("get", "data. php? Name = "+ name, true );
- XmlHttp. onreadystatechange = byname;
- XmlHttp. send (null );
- }
}
Function byname ()
- {
- If (xmlHttp. readyState = 1)
- {
- Document. getElementById ('name'). innerHTML = "loading ....";
- }
- If (xmlHttp. readyState = 4)
- {
- If (xmlHttp. status = 200)
- {
- Var name = xmlHttp. responseText;
- Document. getElementById ('name'). innerHTML = name;
- }
- }
- }
- Function getEmail (email)
- {
- Var email = document. myform. email. value;
- If (email = "")
- {
- Alert ("user name cannot be blank ");
- Document. myform. email. focus ();
- Return false;
- }
- Else
- {
- S_xmlhttprequest ();
- XmlHttp. open ("get", "data. php? Email = "+ email, true );
- XmlHttp. onreadystatechange = byemail;
- XmlHttp. send (null );
- }
}
- Function byemail ()
- {
- If (xmlHttp. readyState = 1)
- {
- Document. getElementById ('email '). innerHTML = "loading ....";
- }
- If (xmlHttp. readyState = 4)
- {
- If (xmlHttp. status = 200)
- {
- Var email = xmlHttp. responseText;
- Document. getElementById ('email '). innerHTML = email;
- }
- }
- }
2. register. php file
- Register page_bbs.it-home.org
|