How to load external JS throug JS

How to load/import external javascript/jquery through js file.



In the event that you need to incorporate a JS document in a JS you can utilize jQuery for that
$.getScript('another_file.js', function() {
    //script is loaded and executed put your dependent JS here
});
Also, in the event that you can't utilize jQuery
var imported = document.createElement('script');
imported.src = '/path/to/imported/script';
document.head.appendChild(imported);

Are this article be help you ?. Please share this article.

Comments

Popular posts from this blog

Find Backlink From Google Dork

List of weapon buff materials, effects and how it can be durango wild lands

Install deb package via Termux