H
H
hellomynameis2011-12-12 09:03:01
JavaScript
hellomynameis, 2011-12-12 09:03:01

Loading js files after page rendering with AJAX?

Please tell me a simple way to implement asynchronous loading of js files on the page after it has been rendered.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anatoly, 2011-12-12
@taliban

form submission to hidden iframe

A
avrelian, 2011-12-12
@avrelian

Simplest:

var scriptEl = document.createElement('script');
scriptEl.setAttribute("type","text/javascript");
scriptEl.setAttribute("src", YOUR_JAVASCRIPT_FILE);
document.getElementsByTagName("head")[0].appendChild(scriptEl);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question