a1exlism
12/3/2016 - 11:17 AM

jQuery_chain_calling.js

//  with Ajax defer

//  V1.5-
function successCallback(a) {
 console.log(a); 
}
function failCallback(a) {
 console.log(a); 
}
$.ajax({
  url: 'test.com',
  success: successCallback(data),
  error: failCallback(err)
})


//  V1.5+
$.ajax('test.com')
  .done(successCallback(data))
  .fail(failCallback(data));