Skip to content

Instantly share code, notes, and snippets.

@vihoangson
Created September 11, 2015 08:03
Show Gist options
  • Save vihoangson/c15378047495b25fc22c to your computer and use it in GitHub Desktop.
Save vihoangson/c15378047495b25fc22c to your computer and use it in GitHub Desktop.
$.ajax({
url: '/path/to/file',
type: 'default GET (Other values: POST)',
dataType: 'default: Intelligent Guess (Other values: xml, json, script, or html)',
data: {param1: 'value1'},
beforeSend: function (){
this_s.after(" <img src='img/loading.gif' class='loading_ajax'> ");
}
})
.done(function() {
$(".loading_ajax").remove();
console.log("success");
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
@vihoangson
Copy link
Author

2015-09-14 16_03_11-c__users_santo_appdata_roaming_sublime text 3_packages_user_ajax_c sublime-snipp

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