是否有可能使用jQuery的get速记设置AJAX超时参数?如果没有,用速记的请求报文曾经超时?
jQuery.get(
URL,
[ 数据 ],
[回调(数据,textStatus,XMLHtt prequest)],
[ 数据类型 ]
)
感谢。
解决方案是否有可能使用jQuery的get速记设置AJAX超时参数?
不,不是的每个请求的,虽然你可以使用 $。ajaxSetup ()
做它的所有的要求。
如果没有,请与速记的请求报文曾经超时?
没有,默认情况下,他们不会(除非你使用 $ ajaxSetup({超时:值});
),默认 暂停
选项没有定义,同 0
,意思是不超时。
要做到超时的每个请求的,而不是在全球范围,你必须切换到手写格式为:
$。阿贾克斯({
网址:网址,
数据:数据,
成功:回调(数据,textStatus,XMLHtt prequest)
数据类型:数据类型
超时:timeoutvalue
});
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.
解决方案Is it possible to set the ajax timeout parameter using jQuery's get shorthand?
No, not per request, though you can use $.ajaxSetup()
to do it for all requests.
If not, do requests sent with the shorthand ever timeout?
No, by default they won't (unless you used $.ajaxSetup({ timeout: value });
), the default timeout
option isn't defined, the same as 0
meaning "don't timeout".
To do a timeout per request and not globally, you'd have to switch to the longhand format:
$.ajax({
url: url,
data: data,
success: callback(data, textStatus, XMLHttpRequest),
dataType: dataType,
timeout: timeoutvalue
});