首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >JQuery ajax调用默认超时值

JQuery ajax调用默认超时值
EN

Stack Overflow用户
提问于 2010-03-24 19:55:01
回答 3查看 117K关注 0票数 75

我收到了一个无法复制的bug报告,但ajax调用超时是目前最好的猜测。

因此,我正在尝试找出jQuery $.ajax()调用的超时的默认值。有谁有主意吗?在jQuery文档中找不到它。

提前谢谢你,马库斯

EN

回答 3

Stack Overflow用户

发布于 2012-11-08 07:19:26

顺便说一句,当我试图诊断一个类似的bug时,我意识到如果jquery的ajax错误回调由于超时而失败,它将返回" timeout“状态。

下面是一个例子:

代码语言:javascript
复制
$.ajax({
    url: "/ajax_json_echo/",
    timeout: 500,
    error: function(jqXHR, textStatus, errorThrown) {
        alert(textStatus); // this will be "timeout"
    }
});

Here it is on jsfiddle

票数 22
EN

Stack Overflow用户

发布于 2014-07-24 12:29:25

默认情况下,没有超时。

票数 6
EN

Stack Overflow用户

发布于 2021-06-17 00:48:36

请参考此接口信息。

代码语言:javascript
复制
timeout
Type: Number
Set a timeout (in milliseconds) for the request. A value of 0 means there 
will be no timeout. This will override any global timeout set with 
$.ajaxSetup(). The  timeout period starts at the point the $.ajax call is made; 
if several other  requests are in progress and the browser has no connections 
available, it is  possible for a request to time out before it can be sent. In 
jQuery 1.4.x and  below, the XMLHttpRequest object will be in an invalid state if 
the request  times out; accessing any object members may throw an exception. In 
Firefox 3.0+  only, script and JSONP requests cannot be cancelled by a timeout; 
the script  will  run even if it arrives after the timeout period.
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2507355

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档