php - Ajax code doesn't bring me to the right page
one text
Solution:
The answer to this question was to add trim.
function auth() {
email = document.getElementById("email").value;
pass = document.getElementById("password").value;
sendGetRequest("login.php", {email: email, password: pass}, function callback(r) {
if (r.trim() == "loggedin") {
location.href = 'index.php';
} else {
alert(r);
}
});
}
Source