Having a problem where the form submits before the validateUsername function has a chance to complete the username check on the server-side.
How do I submit the form
In jQuery there is a solution for the same. I need to check if a user exists or not in my application during some JavaScript. Here is the code:
var pars = "username="+ username;
var some = $.ajax({url: 'AjaxUserNameExist.php',
type: 'GET',
data: pars,
async: false
}).responseText;
if(some=="1") //this is value Got from PHP
{
alert("We cannot Go");
return false;
}
if(some=="0")
{
alert("We can Go");
return true;
}