Chrome在120秒后超时Ajax请求? [英] Chrome timeout Ajax request after 120 seconds?

查看:517
本文介绍了Chrome在120秒后超时Ajax请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定它是否是一个错误或配置错误,但我一直持续120秒获取取消的ajax请求。没有给出http响应代码。

服务器端运行在LAMP堆栈上,并且使用mod_php5将php max_execution_time设置为240秒



奇怪的是,如果我在没有ajax的情况下请求相同的页面,它将在120秒后不会超时。

早期的测试显示,firefox的功能相同



任何人都可以帮助解决这个错误/烦恼吗?

示例代码

  set_timeout_limit(o); 
sleep(1000);


解决方案

尝试添加 xxx (以毫秒为单位)给您的AJAX调用



例子:

  $。ajax({
url:test.html,
timeout:240000,
context:document.body,
success:function( ){
$(this).addClass(done);
}
});


I am not sure if it is a bug or configuration error but I keep getting ajax requests "canceled" at exactly 120 seconds. No http response code given.

The server side is running on a LAMP stack and the php max_execution_time is set to 240 seconds using mod_php5

Oddly enough, if I request the same page without ajax, it won't timeout after 120 seconds.

Early tests shows that firefox does the same thing.

Can anyone help with this bug/annoyance?

Sample code

set_timeout_limit(o); 
sleep(1000);

解决方案

try to add timeout: xxx (in ms) to your AJAX call

example:

$.ajax({
  url: "test.html",
  timeout: 240000,
  context: document.body,
  success: function(){
    $(this).addClass("done");
  }
});

这篇关于Chrome在120秒后超时Ajax请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆