Skip to content

Instantly share code, notes, and snippets.

@chukShirley
Created May 21, 2015 13:28
Show Gist options
  • Select an option

  • Save chukShirley/6290364b28f57767ce19 to your computer and use it in GitHub Desktop.

Select an option

Save chukShirley/6290364b28f57767ce19 to your computer and use it in GitHub Desktop.
Treat $.ajax() calls as promises
function saveNewCustomer(customerData){
return $.ajax({
type:'POST',
url:'myUrl',
data:customerData,
dataType:'json'
});
}
saveNewCustomer.done(function(response){
// work with response
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment