开发者

Javascript function returning undefined

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜