Skip to content

Instantly share code, notes, and snippets.

@AlbertoMonteiro
Created July 11, 2012 19:40
Show Gist options
  • Save AlbertoMonteiro/3092741 to your computer and use it in GitHub Desktop.
Save AlbertoMonteiro/3092741 to your computer and use it in GitHub Desktop.
Ajax + jQuery + 302 = Weird behavior
$.ajax({
type: 'POST',
url: url,
data: $('form').serialize(),
success: function(a) {
console.log("success",a);
} ,
statusCode: {
200: function(a) {
console.log("200",a);
},
400: function(a) {
console.log("400",a);
},
404: function(a) {
console.log("404",a);
},
500: function(a) {
console.log("500",a);
},
},
error:function(a) {
console.log("error",a);
},
complete: function(a) {
console.log("complete",a);
}
});
//output
/*
Como é:
200, Object
error, Object
complete, Object
Como deveria ser:
success, Object
complete, Object7
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment