Chrome 中 JQuery 停止和挂起的 ajax 请求

2023-05-15前端开发问题
41

本文介绍了Chrome 中 JQuery 停止和挂起的 ajax 请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

限时送ChatGPT账号..

有时,我的应用程序中的 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:

  1. 我没有安装广告拦截器.
  2. 我已禁用预测网络操作以提高页面加载性能"在 Chrome 中标记.
  3. 我还在 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 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

ajax请求获取json数据并处理的实例代码
ajax请求获取json数据并处理的实例代码 $.ajax({ type: 'GET', url: 'https://localhost:44369/UserInfo/EditUserJson',//请求数据 data: json,//传递数据 //dataType:'json/text',//预计服务器返回的类型 timeout: 3000,//请求超时的时间 //回调函数传参 suc...
2024-11-22 前端开发问题
215

layui 单选框、复选框、下拉菜单不显示问题如何解决?
1. 如果是ajax嵌套了 页面, 请确保 只有最外层的页面引入了layui.css 和 layui.js ,内层页面 切记不要再次引入 2. 具体代码如下 layui.use(['form', 'upload'], function(){ var form = layui.form; form.render(); // 加入这一句});...
2024-11-09 前端开发问题
313

layui中表单会自动刷新的问题
layui中表单会自动刷新的问题,因为用到layui的表单,遇到了刷新的问题所以记录一下: script layui.use(['jquery','form','layer'], function(){ var $ = layui.jquery, layer=layui.layer, form = layui.form; form.on('submit(tijiao)', function(data){ a...
2024-10-23 前端开发问题
262

jQuery怎么动态向页面添加代码?
append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href...
2024-10-18 前端开发问题
125

Rails 3.1 ajax:成功处理
Rails 3.1 ajax:success handling(Rails 3.1 ajax:成功处理)...
2024-04-20 前端开发问题
11

ExecJS::ProgramError: SyntaxError: 保留字“function"
ExecJS::ProgramError: SyntaxError: Reserved word quot;functionquot;(ExecJS::ProgramError: SyntaxError: 保留字“function)...
2024-04-20 前端开发问题
13