Ajax does not refresh the code _ajax related to the application in registering the username
Source: Internet
Author: User
var xmlHttp;
UName ()//user name loses focus
{
if (all.uname.== "")
{
All.l1.innerhtml= "cannot be empty!" ";
SetTimeout ("Close (1)", 1500);
Return
}
Else
{
Xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP");
Xmlhttp.onreadystatechange=deal; callback function
var url= "ajax.aspx?user= '" +all.uname.+ ""; The page that will jump to the test user name
Xmlhttp.open ("Get", url,true); Submit the form to the URL in Get mode, and start a step process
Xmlhttp.send (NULL); Send
}
}
Deal ()
{
Alert (xmlhttp.readystate+ "__" +xmlhttp.status);
if (xmlhttp.readystate!=4)
{return;}
if (xmlhttp.status!=200)//equal to 500 is an SQL statement or database error
{return;}
//
var num = Xmlhttp.responsetext; Information sent by the receiving server
alert (num);
All.l1.innertext= "";
if (num>0)
{
all.l1.innertext= "The secondary username is already in use!" ";
}
Else
{
all.l1.innertext= "√";
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service