The situation is as follows:
function evaluateUser(){
//AJAX call, returning true or false
}
if(evaluateUser()){
//do something
}else{
//do something else
}
AFAIK jqueryAJAX calls create a promise. So I can indeed do something like this:
function evaluateUser(){
//return AJAX Call
}
The problem is that I'm just returning a promise, and not the result of the async operation. However, since I'm new to promises, I wonder if I could do something with resolve/reject?
I haven't seen any resolve/reject syntax inside jquery AJAX calls yet, but since they create promises, resolve/reject must be implemented inside them, aren't they?
And if so, can one somehow use resolve/reject to make a distinction between true/false? The async operation really does just that, in the end. So while I can't really "unwrap" the promise generated by the AJAX call, is there at least a way to distinguish between a promise that was rejected and a promise which was resolved? So that I could somehow make the true/false result inside the asynchronous world visible to the synchronous world?