Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
HTML script doesn't wait until previous script is loaded

I get the testFile.js filename from url parameters, so it is loaded dynamically. Then i do:

    <script>jQuery.getScript('testFolder/testFile.js');</script>
    <script src="ok1.js" type="text/javascript" charset="UTF-8"> </script>
    <script src="ok2.js" type="text/javascript" charset="UTF-8"> </script>

testFile.js has: function getFile0(){}

ok1.js has:

function getFile1(){} 
function getFile2(){} 
function getFile3(){}

ok2.js has: var _getFiles = [getFile0(), getFile1(), getFile2(), getFile2()];

Although, it is supposed to load first the testFile.js, then ok1.js and finally ok2.js, i get this error for ok2.js: Uncaught ReferenceError: getFile0 is not defined

I have tried plenty of stuff like:

jQuery.getScript('testFolder/testFile.js').done(function() {
    jQuery.getScript('ok1.js').done(function() {
        jQuery.getScript('ok2.js');
    });
});

it is loading without error, but the page is not working as it should.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!