I am new about PHP and ajax
Ajax return data=="OK" or data=="NO" depends on the email in the database but if-else block returns always same value.It prints always last block like "email is available!" I couldn't find the mistake.
$.ajax({
type: 'post',
url: 'check_email.php',
data: {email:email,},
success: callback});}
function callback(data){
email_error = false;
$("#email_error").css("display","block");
if(data =="OK"){
$("#email_error").html("Email was already used!");
$("#email_error").css("color","#990000");
$("#email_error").show();
email_error = true;
}else{
$("#email_error").html("Email is available!");
$("#email_error").css("color","#F1F0D1");
$("#email_error").show();
email_error = false;
}
}
Aucun commentaire:
Enregistrer un commentaire