Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 30th, 2012  |  syntax: None  |  size: 0.55 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <!DOCTYPE html>
  2. <head>
  3. <title>Poor man's script loader</title>
  4. </head>
  5. <body>
  6. <div>Expected value: <b>1.6.1</b></div>
  7. <div>Actual value: <b id="ret">Loading</b></div>
  8. <script>
  9.   /**
  10.    * @function
  11.    */
  12.   var scriptLoader = function(a,b,c,d,e){d=document;c=d.createElement('script');c.src=a;e=!b;c.onload=function(){!e&&b();e=!0;};d.body.appendChild(c);}
  13.  
  14.   scriptLoader(
  15.     'https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js',
  16.     function(){
  17.       document.getElementById( "ret" ).innerHTML = window.jQuery.fn.jquery;  
  18.     }
  19.   );
  20. </script>
  21. </body>