Note that there are some explanatory texts on larger screens.

plurals
  1. POSimultaneous ajax calls result in random errors
    primarykey
    data
    text
    <p>I have the following:</p> <pre><code>myfunc = function(url, callback, etc...) { $.ajax({ type: 'GET', url: url, etc.}); } function changeDivThis(data) { $('#this').html(data); } function changeDivThat(data) { $('#that').html(data); } </code></pre> <p>and I call the ajax get function twice in succession:</p> <pre><code>myfunc('/getData?mode=THIS', changeDivThis, etc...); myfunc('/getData?mode=THAT', changeDivThat, etc...); </code></pre> <p>and the result is that some significant fraction of the time, say 20% of the time, the div with id='this' will get populated with the data that was returned by the call for THAT. And when I look at the app server logs, I see some unexpected stuff, like only one request.</p> <p><strong>When I run in Firebug, the bug never occurs,</strong> everything is fine. I noticed that Firebug considerably slows down browser operation, so I'm assuming this is a clue to the cause, having something to do with concurrency, e.g. the second call returns from the server first on some occassions, and the browser thinks it's the response to the first call. Correct?</p> <p>So in my limited experience with AJAX, I thought it supported throwing several concurrent requests at the server and then it sorted out the responses in whatever order they returned. This problem leads me to believe that AJAX (or my version of Firefox = 3.6.24/jQuery = 1.4.4) sees two requests to the same url as the same even though they both have different parameters. </p> <p>I saw this highly-ranked page on Google: <a href="http://blogger.forgottenskies.com/?p=173" rel="nofollow">http://blogger.forgottenskies.com/?p=173</a> which makes me believe I'm not alone in experiencing this issue.</p> <p>Thanks for any insights.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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