Java Reference
In-Depth Information
if (sResponseText == “available”)
{
isEmailTaken = false;
}
else
{
isEmailTaken = true;
}
}
function form_submit()
{
var request = new HttpRequest();
request.async = false;
//First check the username
var userValue = document.getElementById(“username”).value;
if (userValue == “”)
{
alert(“Please enter a user name to check!”);
return false;
}
request.url = “formvalidator.php?username=” + userValue;
request.callBack = checkUsername_callBack;
request.send();
if (isUsernameTaken)
{
alert(“The username “ + userValue + “ is not available!”);
return false;
}
//Now check the email
var emailValue = document.getElementById(“email”).value;
if (emailValue == “”)
{
alert(“Please enter an email address to check!”);
return false;
}
request.url = “formvalidator.php?email=” + emailValue;
request.callBack = checkEmail_callBack;
request.send();
if (isEmailTaken)
{
alert(“I'm sorry, but “ + emailValue + “ is in use by “ +
“another user.”);
return false;
}
Search WWH ::




Custom Search