Skip to content

Instantly share code, notes, and snippets.

@Fridus
Created November 28, 2014 10:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fridus/52bfe0a919e553a97411 to your computer and use it in GitHub Desktop.
Save Fridus/52bfe0a919e553a97411 to your computer and use it in GitHub Desktop.
jQuery getScript multiple
jQuery.getScripts = function(scripts, callback) {
var progress = 0;
var _getScript = function() {
if (progress == scripts.length) { return callback(); }
$.getScript(scripts[progress], function() {
progress++;
_getScript();
});
};
_getScript();
};
/*
$.getScripts(['script1','script2','script3', function(){
Code...
});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment