Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

216
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda