jquery ajax timeout含义是设置请求超时时间,不涉及服务器响应时间
2015-06-19 09:40
1016 查看
理解错误:ajax访问超时怎么办?服务器处理时间过长,或网速很慢,服务器返回数据很慢等,于是想到使用timeout设置,网上有类似代码:
经测试:服务器处理方法中线程延时,结果证明,timeout无效,客户端等待响应,status返回sucess。说明, timeout含义是设置请求超时时间,不涉及服务器响应时间!
官网说明
timeout
Type:
Number
Set a timeout (in milliseconds) for the request. This will override any global timeout set with
$.ajaxSetup(). The timeout period starts at the point the$.ajaxcall 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.
经测试:服务器处理方法中线程延时,结果证明,timeout无效,客户端等待响应,status返回sucess。说明, timeout含义是设置请求超时时间,不涉及服务器响应时间!
官网说明
timeout
Type:
Number
Set a timeout (in milliseconds) for the request. This will override any global timeout set with
$.ajaxSetup(). The timeout period starts at the point the$.ajaxcall 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.
相关文章推荐
- JQuery中模拟image的ajaxPrefilter与ajaxTransport处理
- JavaScript和JQuery的鼠标mouse事件冒泡处理
- jquery 页面滚动到底部自动加载插件集合
- jquery对url中的中文解码
- JavaScript和JQuery的鼠标mouse事件冒泡处理
- JQuery中模拟image的ajaxPrefilter与ajaxTransport处理
- 基于jQuery+Cookie实现的防止刷新的在线考试倒计时
- JQuery实现的图文自动轮播效果插件
- jquery实现的代替传统checkbox样式插件
- jquery gridster 拖拽功能 中文文档
- 使用jstl的Foreach 和jquery的each()的index属性
- 手机新闻网站,掌上移动新闻,手机报client,jQuery Mobile手机新闻网站,手机新闻网站demo,新闻阅读器开发
- validate验证+jquery+ajax提交表单
- jquery easyui的dialog href的参数传递问题
- jquery easyui DataGrid 数据表格 属性
- jQuery + css 公告从左往右滚动
- 页面导航定位
- jQuery.ajax
- jQuery 开发之jQuery事件二
- jQuery easyui combotree