I have the following functions...
If(signInSet(sign_in_data)){
do something... //appends data to a variable that is outputted after the if statement
}
else{
do something else...
}
Then...
signInSet(sign_in_data){
var equal = false;
$.get('url', function(currentDate){
$.each(sign_in_data, function compareDate(){
if(this.date === currentDate){
equal = true;
return false; //to end the each loop
}
});
//at this point i can see and print out the value of equal
});
Im have some knowledge of the asynchronous nature of this function, what im wondering is how i can refactor my code to be able to see the value of equal so i can use it in my if statement. thanks in advance.