問題描述
有時,我的應用程序中的 Ajax 調用(通過 JQuery 1.8)卡在待處理"狀態.很長一段時間(有時長達 17 分鐘).我用谷歌搜索過,所有可能的解決方案都不起作用:
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:
- 我沒有安裝廣告攔截器.
- 我已禁用預測網絡操作以提高頁面加載性能"在 Chrome 中標記.
- 我還在 Ajax 調用中添加了一個查詢字符串以使其唯一(以禁用任何 Chrome 緩存鎖定).
你知道如何解決這個問題嗎?
Do you have a any idea how to solve this?
在下面的示例中,請求等待了 17 分鐘(通過 Fiddler 驗證它僅在 17 分鐘后發送).
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"
看圖:
推薦答案
我偶然發現了完全相同的問題.一旦我禁用:
I have stumbled on exactly the same problem. As soon as I disabled:
使用預測服務更快地加載頁面
Use a prediction service to load pages more quickly
轉到 高級設置 -> 隱私 -> ca.第三個復選框,一切都開始正常工作.我無法重現該錯誤.
Go Advanced Settings -> Privacy -> ca. 3rd checkbox, everything started to work as it should. I was unable to reproduce the error.
jquery/ajax
輪詢器在 Firefox 中完美運行.它只是 Chrome - 在 Linux 和視窗.
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.
這篇關于Chrome 中 JQuery 停止和掛起的 ajax 請求的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!