chukShirley
5/21/2015 - 1:28 PM

Treat $.ajax() calls as promises

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