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
Post a Comment
Bila Ada posting yang kurang, atau error atau yang lainnya, silahkan tinggalkan komentar agar artikel/post di perbaiki.
Jangan Lupa Cek Box "Notify Me" agar tahu komentar kamu dibalas oleh saya.
If there are any posts that are missing, or error or anything else, please leave a comment for the article / post to be fixed.
Do not Forget Check Box "Notify Me" to know our comments replied by me.