Create a gist now

Instantly share code, notes, and snippets.

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