i have a form and want to validate it using api(register-checker.php File):
var email_status = false;
var email = $("#register_email").val();
$.ajax({
url: "engine/ajax/register-checker.php",
dataType: "html",
type: "GET",
data: {
field : "email",
value : email
},
success: function(result){
if(result == "false"){
$("#register_email_error").text("this email used by another user");
$("#register_email_error").fadeIn();
}else{
console.log("here is executed");
email_status = true;
}
}
}); console.log("email_status: " + email_status);
when validate is done and register-checker.php File return "true" , console.log("here is executed") Executes but when i log email_status variable in the end of file, the console show "email_status: false". what's wrong?