mercredi 5 mars 2014

Asynchronously populating two elements with ajax results


Vote count:

0




I'd like to display the results of two ajax calls in two HTML elements:



$("#services").load("/stops/" + stop_id + "/services");
$("#times").load("/stops/" + stop_id + "/times");


In the XHR view I can see that the first callback returns shortly, but the element in the webpage is not populated immediately. It looks like both elements are populated at the same instant, and it's only when the longer call returns.



  1. Why does it behave like this?

  2. How can I make sure each HTML element is populated as soon as the data is received from the server?



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire