I want to make a function that supports done
but without returning ajax.
function checkAndReturn(){
if(global.id){
return global.id; // the problem might be here
}else{
return $.get("http://someurl.com",null,function(){...})
}
}
Here checkAndReturn.done(function(){...})
works if global.id
is not available, but it is not working if global.id
is available.
I think I should be returning any other object and box my data to that object to make my done work, maybe xhr
?.