问题描述
有时,我的应用程序中的 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 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!