tags:

views:

725

answers:

1

I am including pages using Ajax but I also need to include their respective javascript files, which requires removing the previous javascript files from memory at the same time.

How can I unload the currently-loaded javascript files (as well as their code in memory) so that I can load the new page's files? They will more than likely conflict, so having multiple independent files' javascript files loaded.

+2  A: 

This really sounds like you need to reevaluate your design. Either you need to drop ajax, or you need to not have collisions in you method names.

You can review this link: http://www.javascriptkit.com/javatutors/loadjavascriptcss2.shtml

Which gives information on how to remove the javascript from the DOM. However, modern browsers will leave the code in memory on the browser.

Chris Lively