Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stalled and pending ajax requests by JQuery in Chrome

Tags:

Once in a while, my Ajax calls (via JQuery 1.8) in my application are stuck with status "pending" for a long time (sometimes up to 17 minutes). I've googled it and all possible solutions didn't work:

  1. I have no ad blocker installed.
  2. I've disabled the "predict network actions to improve page load performance" flag in Chrome.
  3. I've also added a query string to the Ajax call to make it unique (to disable any Chrome cache locking).

Do you have a any idea how to solve this?

In the example below, the request was pending for 17 minutes (verified with Fiddler that it was sent only after 17 minutes).

   GET http://www.mywebsite.com/foo/rest/publishers/1/packages?_=1421584749323    HTTP/1.1    Host: www.mywebsite.com    Connection: keep-alive    Accept: application/json, text/javascript, */*; q=0.01    X-Requested-With: XMLHttpRequest    User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36    (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36    Content-Type: application/json    Referer: http://www.mywebsite.com/foo/client/home    Accept-Encoding: gzip, deflate, sdch    Accept-Language: en-US,en;q=0.8,he;q=0.6,ru;q=0.4    Cookie: JSESSIONID=C668509B5AFCDEBE9C9774C4721AFB9D;    aaassz="ddss" 

See image: https://drive.google.com/file/d/0B9uQiZLJG1csNzlPcHZEWHl1Z2c/view

like image 463
Wasafa1 Avatar asked Jan 18 '15 13:01

Wasafa1


People also ask

How do I cancel a pending AJAX request?

Just use ajax.abort(); } //then you make another ajax request $. ajax( //your code here );

Why is AJAX success not working?

ajax post method. The reason was my response was not in the JSON format so there was no need for the dataType: 'json' line in the submit method. In my case, the returned response was in text format that's why it was not going to success event. Solution: Remove dataType: 'json' line.


1 Answers

I have stumbled on exactly the same problem. As soon as I disabled:

Use a prediction service to load pages more quickly

Go Advanced Settings -> Privacy -> ca. 3rd checkbox, everything started to work as it should. I was unable to reproduce the error.

The jquery/ajax poller works perfectly in Firefox. It's only Chrome - tested on Linux & Windows.

It is not a perfect solution, as it won't affect users in the global sense - but maybe you are in the same situation as I - limited audience.

like image 180
michael Avatar answered Sep 18 '22 18:09

michael