Created
December 16, 2014 09:05
-
-
Save terrymun/b38b8b65f559f064417d to your computer and use it in GitHub Desktop.
Old $.ajax() request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
data: someData, | |
dataType: 'json', | |
url: '/path/to/script', | |
success: function(data, textStatus, jqXHR) { | |
// When AJAX call is successfuly | |
console.log('AJAX call successful.'); | |
console.log(data); | |
}, | |
error: function(jqXHR, textStatus, errorThrown) { | |
// When AJAX call has failed | |
console.log('AJAX call failed.'); | |
console.log(textStatus + ': ' + errorThrown); | |
}, | |
complete: function() { | |
// When AJAX call is complete, will fire upon success or when error is thrown | |
console.log('AJAX call completed'); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a problem with
complete: function() { // When AJAX call is complete, will fire upon success or when error is thrown console.log('AJAX call completed'); };
You need to delete the ';' at the end of the function.
Thanks