为了账号安全,请及时绑定邮箱和手机立即绑定

关于ajax的timeout问题

关于ajax的timeout问题

PHP
慕森卡 2019-03-02 19:13:47
使用ajax提交数据的时候,由于网络问题很久都没提交完毕,此时如果设置timeout的值,例如5秒,那么这个值是timeout==前端提交时间? 还是 timeout==前端提交时间+后端响应时间?当timeout值达到的时候是否已经触碰到服务器呢?希望有大神能相信解答一下
查看完整描述

2 回答

?
阿晨1998

TA贡献2037条经验 获得超6个赞

你指的网络问题是?你浏览器访问后端接口 看能访问到不

查看完整回答
反对 回复 2019-03-15
?
尚方宝剑之说

TA贡献1788条经验 获得超4个赞

是 jQuery 的 ajax ? jQuery.ajax

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.

从调用 $.ajax 开始计算,不管是否触碰到服务器,只要到时间就 time out。


查看完整回答
反对 回复 2019-03-15
  • 2 回答
  • 0 关注
  • 1122 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号