Sequential script loading on demand

This little script uses the JQuery getScript command, enforcing sequential loading order to ensure script dependencies are honoured: function LoadScriptsSequentially(scriptUrls, callback) { if (typeof scriptUrls == 'undefined') throw "Argument Error: URL array is unusable"; if (scriptUrls.length == 0 && typeof callback == 'function') callback(); $.getScript(scriptUrls.shift(), function() { LoadScriptsSequentially(scriptUrls, callback); }); } Here's how you use... Continue Reading →

Advertisements

Create a website or blog at WordPress.com

Up ↑