The first A in AJAX means "Asynchonous." The call is executed, and the function continues, without waiting for the call to return.
async false, . , return false check, jQuery:
Ajax "", , , . async $.ajax() true, , . false (, , ) , , .
, , Ajax .
. , - FF 3.6.
var name_success = true;
$.ajax({
type: "POST",
async: false,
url: "username.asp",
data: "username="+theform.username.value,
success: function(msg){
username = msg;
if (username == "EXISTS") {
alert("username already in use");
name_success = false;
return false;
}
}
});
alert (name_success);