Its a bit strange. I am making a bitly api call and it returns undefined for all the calls, but if I add an alert() right before I get the link variable, it returns the correct link.
Now if I add the alert here:
function getBitlyLink(){
alert(bitlyLink);
return bitlyLink;
}
I get the correct links and not undefined. What exactly is that alert box doing??
Your code is not being executed synchronously. Pass a callback to your getBitlyLink()
function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.