Any reason why my $.ajax success callback is not executed in Jquery?
- by arma
Hello,
Today i discovered that my dev version of my website do not execute success callback, but all other javascript and jquery code is running good. Even my ajax request is performed and i can see response in firebug.
$('#login').submit(function(){
var email = $('#l_email').val();
var pass = $('#l_pass').val();
if(email && pass != ''){
var str = decodeURIComponent($(this).serialize());
$.ajax({
type: "POST",
url: "login.php",
data: str,
success: function(msg){
if(msg == 'OK'){
window.location = 'index.php'
}else if (msg == 'NOT_OK'){
if(lang == 'lv'){
alert(message);
}else if(lang == 'ru'){
alert(message);
}
}else if (msg == 'EMAIL_NOT_VALID'){
if(lang == 'lv'){
alert(message);
}else if(lang == 'ru'){
alert(message);
}
}
}
});
}else{
alert('That form is empty.');
}
return false;
});
The thing is $.ajax part executes fine and i can see response in firebug "OK". But redirect is not happening and even if i replace that redirect with something like alert or console.log nothing comes up.
What could cause this? It's really hard to track since firebug gives no errors.