Reputation: 1603
I'm having difficulty getting ajax success function to differentiate the results that come in.
$.ajax(
{
type: "POST",
url: '../ajax/ajaxLogin.php',
data: { "username": loginUsername, "password": loginPass },
success: function (loggedIn)
{
if(loggedIn == "OK")
{
window.location = 'index.php';
} else
{
alert(loggedIn);
}
}
});
When user credentials are correct then php sends "OK" to ajax and the user should be redirected to index.php. The result I get is always an alert. I get "OK" in alert windows as well as other messages. Whatever happens I always get something in alert window and never get redirected. What might be wrong here?
Upvotes: 0
Views: 57