Skip to content

Instantly share code, notes, and snippets.

@sandro
Created January 29, 2009 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandro/54387 to your computer and use it in GitHub Desktop.
Save sandro/54387 to your computer and use it in GitHub Desktop.
load jquery with callback
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment