Is there any jquery plugin (instead of incldeMany) or simple function to include js-files on demand ?
for example:
$.include('myscript.js');
?
Is there any jquery plugin (instead of incldeMany) or simple function to include js-files on demand ?
for example:
$.include('myscript.js');
?
How about jQuery.getScript()? It's built in to jQuery and works like so:
$.getScript('ajax/test.js', function() {
alert('Load was performed.');
});
$.getScript('test.js', function() { alert('Load was performed.'); });
alert()
might not always be fired. See stackoverflow.com/a/19819672/13019 for a good solution.
Aug 16, 2019 at 3:01
Not exactly a jQuery plugin, but you might try looking into RequireJS. Especially the "How to use RequireJS with jQuery" section.
I don't have much experience with this solution yet, but from what I've read and played around with I like the possibilities.