grimen (owner)

Fork Of

gist: 54387 by sandro load jquery with callback

Revisions

gist: 79744 Download_button fork
public
Public Clone URL: git://gist.github.com/79744.git
Embed All Files: show embed
load_jquery_with_callback.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 function load_jquery(){
   var s=document.createElement('script');
   s.type='text/javascript';
   s.src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js';
   var head = document.getElementsByTagName("head")[0];
   var done = false;
   
   s.onload = s.onreadystatechange = function(){
     if ( !done && (!this.readyState ||
                    this.readyState == "loaded" || this.readyState == "complete") ) {
       done = true;
       head.removeChild(s);
 
       your_jquery_loaded_callback_function();
     }
   };
   
   head.appendChild(s);
 }