I have the code:
if (venue_exists(instagramUserID)){
alert('A');
}else {
alert('C');
}
function venue_exists(instagramUserID) {
$.get( "/venues/" + instagramUserID, function(json) {
if (json.data.success){
alert('B');
return true;
}
}, "json" );
Currently my output is: B
, C
I'm confused as to why the code is not going into A
as true
is being returned. Does this have something to do with the asynchronous request
?
Any help would be greatly appreciated.