When my page loads, I make one AJAX call, and then another conditionally upon what is on the page. I want to call a function at the end of both; how do I do it?
var dfd = $.when( $.ajax(...) );
if( $("type").val() == "something" ) {
dfd.when( $.ajax(...) );
}
dfd.then(function() {
// final code
});
I can't find much about adding to $.when "conditionally"
or "later" as those search terms are too close to the original purpose of the promise itself, so I just get the standard usage of $.when(a, b).then(c)
Thanks