Any reason why my $.ajax success callback is not executed in Jquery?
Posted
by
arma
on Stack Overflow
See other posts from Stack Overflow
or by arma
Published on 2011-01-17T09:50:05Z
Indexed on
2011/01/17
9:53 UTC
Read the original article
Hit count: 212
jQuery
|jquery-ajax
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.
© Stack Overflow or respective owner