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
});