Skip to content

Instantly share code, notes, and snippets.

@slikts
Created April 13, 2011 11:28
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 slikts/917379 to your computer and use it in GitHub Desktop.
Save slikts/917379 to your computer and use it in GitHub Desktop.
Load jQuery from Google CDN
/*
* @param object callback
* @param object document context
* /
function load_jq(callback, document)
{
if (window.jQuery) {
if (callback) {
callback(jQuery);
}
return;
}
var d = document || window.document;
var s = d.createElement('script');
s.onload = function()
{
jQuery.noConflict();
if (callback) {
callback(jQuery);
}
}
s.setAttribute('src', location.protocol + '//ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js');
d.getElementsByTagName('head')[0].appendChild(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment