I try to use $.when with ajax calls, where on of the calls won't always be called, how can I achieve this. I've been trying to hack around it
var renderThis;
$.when($.post("/blabla", function(data){
renderThis = data;
}),
function(){
if(another){
return $.post("/blabla");
}
else{
return true;
}
})
.then(function(){
render(renderThis)
});
but what I see is that the $.then() isn't called in a deferred manner but is called instantly.
any ideas?