我正在使用AJAX和PHP进行注册页面。
如果注册成功,signup.php将:
echo "success";
以下AJAX代码处理:
if(ajax.responseText != "success"){//if the php file does not echo "success"
document.getElementById('status').innerHTML = ajax.responseText;//AJAX response is displayed in a div with id "status"
} else {//if signup is successful
window.scrollTo(0,0);
document.getElementById("signupform").innerHTML = "OK. Check your email inbox and junk mail box in a moment to complete the sign up process by activating your account.";
}
}
这是我的问题: ajax.responseText //的值为“success”但是(ajax.responseText!=“success”)返回true。