Skip to content

Instantly share code, notes, and snippets.

@jwo
Created July 15, 2011 15:47
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 jwo/1084936 to your computer and use it in GitHub Desktop.
Save jwo/1084936 to your computer and use it in GitHub Desktop.
Dynamically load javascript source files
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script>
//<![CDATA[
window.jQuery || document.write("<script src='/javascripts/jquery.min.js'>\x3C/script>")
//]]>
</script>
if(typeof yourFunctionToCheck != 'function') {
$.getScript("ajax/test.js", function(){
// callback if needed
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment