Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

219
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda