Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple ajax calls at same time
    primarykey
    data
    text
    <p>I have developed some websites and I always stumble a the same point: multiple ajax calls. I have a main page where all the content is loaded asynchronously. When the page is loaded, there are four INDEPENDENT calls that "draw" the page by areas (top, left, right and bottom) and while it is loaded I show to the user the typical ajax spins. So, when a request is received by the browser I execute the callback and the different areas are drawing at different time. The fact is that the answer for the server sometimes are mixed up, I mean, the answer of top is drawn in the left or vice-versa.</p> <p>I've tried some solutions like creating a timestamp in each request to indicate to the browser and server that each request is different.</p> <p>Also I've tried to configure some parameters of cache in the server, in case.</p> <p>The only way in which works has been including the request2 in the callback of the one, etc.</p> <p>Anyone knows the proper way to do it or ever has beaten this issue?? I don't want to do chained request.</p> <p>Thanks</p> <p>Here is an example of what I mean:</p> <pre><code>$(document).ready(function() { $.get('/activity',Common.genSafeId(),function(data){$('#stream').html(data);$("#load_activity").addClass("empty");}); $.get('/messages',Common.genSafeId(),function(data){$('#message').html(data);$("#load_messages").addClass("empty");}); $.get('/deals',Common.genSafeId(),function(data){$('#new_deals_container').html(data);$("#load_deal").addClass("empty");}); $.get('/tasks',Common.genSafeId(),function(data){$('#task_frames').html(data);$("#load_task").addClass("empty");});}); </code></pre> <p>And the html is a simple jsp with four container each one with a different id.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload