How can I add native javascript into $.when
? I get an error for doing this below when I want to use for each inside $.when
. Any ideas?
var scripts = [
"ccommon.js",
"ccommon2.js",
"ccommon3.js"
];
$.when(
// Via $.getScript.
for(var i = 0; i < scripts.length; i++) {
$.getScript(scripts[i]);
}
).done(function(){
//place your code here, the scripts are all loaded.
alert('script loaded');
});