0

I'm writing a short script that loops through an array and loads each of the results found although I'm having some issues with it loading. If I alert my results found in each loop I get the right data but when I attempt to load this data, it fails.

var arrayScripts = new Array (
        'http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js', 
        'scripts/tiny_mce/tiny_mce.js',
        'scripts/jquery.cycle.lite.js',
        'scripts/javascript.default.js',
        'scripts/jquery.default.js'
    );

    for (var i=0; i < arrayScripts.length; i++) {
        scripts.add(arrayScripts[i]);
    }
    scripts.load();

I hope you can see what I'm doing wrong here. It appears to be my code inside of my loop.

Darren Parker
  • 71
  • 1
  • 1
  • 5
  • 1
    Can I suggest a framework, like RequireJS? http://requirejs.org – PaulProgrammer Apr 05 '13 at 17:08
  • Maybe this is what your looking for? http://stackoverflow.com/questions/8278492/javascript-function-to-load-external-js-files- is-needed – user1740058 Apr 05 '13 at 18:07
  • Hi guys and thanks for a reply. I'm simply running a loop that loads my JavaScript files. Therefor upon load of my page, it will continue with the rest of the code whilst my JavaScript files are loaded asynchronously – Darren Parker Apr 05 '13 at 21:04

0 Answers0