使用ajax提交数据的时候,由于网络问题很久都没提交完毕,此时如果设置timeout的值,例如5秒,那么这个值是timeout==前端提交时间? 还是 timeout==前端提交时间+后端响应时间?当timeout值达到的时候是否已经触碰到服务器呢?希望有大神能相信解答一下
2 回答
慕哥9229398
TA贡献1877条经验 获得超6个赞
是 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。
添加回答
举报
0/150
提交
取消