I am using a Javascript Loader [ requireJS ] which loads scripts in parallel to content - however, I have a problem. i.e.
require('http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js');
Typically - as a 'backup' - I've used
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='/scripts/jquery-1.4.4.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
However, when using a java-script loader - this will ALWAYS render jQuery "undefined" - because JS and content is loaded in parallel.
The effect is basically that you are loading jQuery 2x - i.e. 1x through your javascript loader and 1 through "jquery == undefined".
How can I make the "backup" work with a javascript loader ?