Skip to content

Instantly share code, notes, and snippets.

@BrunoCaimar
Created November 13, 2009 00:32
Show Gist options
  • Save BrunoCaimar/233457 to your computer and use it in GitHub Desktop.
Save BrunoCaimar/233457 to your computer and use it in GitHub Desktop.
MeMeThisLoad.js
//
// load.js
// Loads jQuery and the form-building script
//
// First and foremost, JQuery to the rescue
var memeThisJQueryScript = document.createElement('script');
memeThisJQueryScript.setAttribute('language', 'javascript');
memeThisJQueryScript.setAttribute('type', 'text/javascript');
memeThisJQueryScript.setAttribute('src', 'http://memethis.com/js/jquery-1.3.2.min.js');
document.getElementsByTagName('head')[0].appendChild(memeThisJQueryScript);
// We must give the browser some idle time to load JQuery before loading the
// form building script (which depends on it), setTimeout will do the trick
function memeThisLoadFormScript() {
if (typeof jQuery !== 'undefined') {
// jQuery available, load stage 2
$.getScript('http://gist.github.com/raw/233458/96882b7a608cdbb2ef70d9f1395126f29c197c48/MeMeThisBuildForm.js');
} else {
// jQuery not available yet, try again
setTimeout(memeThisLoadFormScript, 100);
}
}
memeThisLoadFormScript();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment