ICPooreman
asked on
is it possible to load js files dynamically via ajax
so I've got an html page. I'm using some YUI scripts and using some ajax within the page. I basically don't want to load the js files until they're needed so I was wondering if there were a way where if somebody clicked a link it could fire something that would load another javascript file in the page?
So for example some YUI library is needed for a function to execute well is it possible to include that library if the library if it wasn't included in the html when the page loaded?
So for example some YUI library is needed for a function to execute well is it possible to include that library if the library if it wasn't included in the html when the page loaded?
I agree with null. That is what I would try.
Note however, that you would want syntactically correct javascript.
Note however, that you would want syntactically correct javascript.
ASKER
ya I've been reading up on it. It appears that you can do what you're stating but you have to be careful with different browser implementations.
I've come across the fact that YUI has a loader utility that might be able to do what I need I'm looking into that but appreciate any other comments people have.
I've come across the fact that YUI has a loader utility that might be able to do what I need I'm looking into that but appreciate any other comments people have.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Never tried it, but I wonder if you could simply append a script tag node to the DOM, with it's source set. I know that you can do the same with an image, and get it to load when its attached to the document.
null