javascript - What do I need to do to get my callback function to run before other things? -


so in js file have this:

if(players[i].src.indexof("http:\/\/vimeo.com/moogaloop") == 0){     var videoid = players[i].src.split("clip_id=")[1].substring(0, 8);      var callback = 'getthumb';     var jsonurl = 'http://vimeo.com/api/v2/video/' + videoid + '.json?callback=' + callback;      var js = document.createelement('script');     js.setattribute('type', 'text/javascript');     js.setattribute('src', jsonurl);     document.getelementsbytagname('head').item(0).appendchild(js);      var thumb;     function getthumb(video) {     thumb = video[0].thumbnail_medium;      } 

the purpose thumbnail of vimeo video. problem having runs through , stuff after , runs function. issue need thumbnail stuff after it, tries undefined variable. works otherwise, meaning if ran in order wanted to, work fine.

you should put code needs run after code in callback in callback, rather merely after in file.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -