why would you be loading the library for each script?

Andy789 wrote:
Hi all,

I have different independent modules using jquery and need to avoid
its double loading. So, instead of loading jquery, I am loading the
code:

if (typeof jQuery != 'undefined') {
document.write('<script type="text/javascript" src="/templates/
yoo_evolution/lib/js/jquery-1.3.2.min.js"></script>');
}

Also, I have added a line var $j = jQuery.noConflict(); as a last line
of jquery library file.

The problem is that though it writes the code on document write, it
does not seem that jquery is loaded at all, because I am getting an
error  jQuery not defined.

What am i doing wrong here? is there a more elegant way to load a
library dynamically?

Thanks

Reply via email to