$.ajax({
url: url,
type: 'default GET (Other values: POST)',
dataType: 'default: Intelligent Guess (Other values: xml, json, script, or html)',
cache: false,
contentType: "application/json; charset=utf-8",
success: function(data) {
console.log("success from method");
},
error: function() {
console.log("error from method");
},
beforeSend: function() {
console.log('Loading...');
}
})
.done(function(data) {
console.log("success");
})
.fail(function() {
console.log("error");
})
.always(function(data) {
console.log("complete");
});