Skip to content

Instantly share code, notes, and snippets.

@terrymun
Created December 16, 2014 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save terrymun/b38b8b65f559f064417d to your computer and use it in GitHub Desktop.
Save terrymun/b38b8b65f559f064417d to your computer and use it in GitHub Desktop.
Old $.ajax() request
$.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');
};
});
@rokity
Copy link

rokity commented Nov 30, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment