Posted By

dan_hoerr on 07/12/11


Tagged

javascript


Versions (?)

Async load any number of remote JS resources


 / Published in: JavaScript
 

  1. function async_js(){
  2. scripts = []
  3. scripts[0] = "http://connect.facebook.net/en_US/all.js#xfbml=1";
  4. scripts[1] = "http://platform.twitter.com/widgets.js";
  5.  
  6. $.each(scripts, function(index){
  7. var s = document.createElement('script');
  8. s.type = 'text/javascript';
  9. s.async = true;
  10. s.src = scripts[index];
  11. var x = document.getElementsByTagName('script')[0];
  12. x.parentNode.insertBefore(s, x);
  13. });
  14.  
  15. }

Report this snippet  

You need to login to post a comment.