设置 jQuery 的 get 速记超时
是否可以使用 jQuery 的 get 简写来设置 ajax 超时参数?如果不是,使用速记发送的请求是否会超时?
jQuery.get(
url,
[ data ],
[ callback(data, textStatus, XMLHttpRequest) ],
[ dataType ]
)
谢谢。
Is it possible to set the ajax timeout parameter using jQuery's get shorthand? If not, do requests sent with the shorthand ever timeout?
jQuery.get(
url,
[ data ],
[ callback(data, textStatus, XMLHttpRequest) ],
[ dataType ]
)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,不是每个请求,尽管您可以使用
$.ajaxSetup( )
对所有请求执行此操作。不,默认情况下它们不会(除非您使用
$.ajaxSetup({ timeout: value } );
),默认超时
选项 未定义,与0
表示“不超时”。要对每个请求进行超时而不是全局超时,您必须切换到普通格式:
No, not per request, though you can use
$.ajaxSetup()
to do it for all requests.No, by default they won't (unless you used
$.ajaxSetup({ timeout: value });
), the defaulttimeout
option isn't defined, the same as0
meaning "don't timeout".To do a timeout per request and not globally, you'd have to switch to the longhand format: