var existingTokenValidated = new Boolean(false);
if($.cookie("sessionToken") != undefined)
{
ValidateToken($.cookie("sessionToken"),function(result){ //wait here
if(result == 'true')
{
existingTokenValidated = true;
}
});
}
if(!existingTokenValidated)
{
GetLoginToken(function(result)
{
if(result == 'true' && $.cookie("sessionToken") != undefined){
callback('true');
}
else if(result == 'false'){
callback('false');
}
});
}
else{
callback('true');
}
I am i beginner to nodes js, want to wait for Validate token to finish as it does in synchronous function call. Currently for a solution i am calling GetLoginTOken twice in my code want to do in the above way.