Created
May 21, 2015 13:28
-
-
Save chukShirley/6290364b28f57767ce19 to your computer and use it in GitHub Desktop.
Treat $.ajax() calls as promises
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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