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

124
Vistas
Reading to JSON URLs with jQuery

I need to read two JSON URLs with jQuery, mangle them together and then proceed updating my UI from the JSON data.

With the two URLs in URLA and URLB and a global variable globalDataA I tried:

function useBothData(dataB) {
   // use dataB and globalDataA
};

function useDataA (data) {
    globalDataA = data
    $.getJSON (URLB, useBothData);
};

$.getJSON (URLA, useDataA);

The idea is that after loading the 1st URL I load the 2nd and then work with them. However this does never seem to return. (I get the Brwoser warning "Script takes too long".)

How can I arrange jQuery's getJSON calls for the two URLs (and their success functions), so that I can then use their data in finally one function?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use the callback function of getJSON

$.getJSON(URLA, useDataA, function(dataB) {
  //useBothData = globalDataA + dataB

  $.getJSON(URLB, useBothData, function(result) {
    //do more stuff
  })
});
about 4 years ago · Juan Pablo Isaza Denunciar
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