admin管理员组文章数量:1356509
I have an event that when clicked initiates a jQuery load(). The load passes several MB of POST data. I am getting aborted errors. How can I set the timeout?
toggleModalLoading();
$("#ele").load('.php',{
'data' : postData },
function(e) {
toggleModalLoading();
});
I have an event that when clicked initiates a jQuery load(). The load passes several MB of POST data. I am getting aborted errors. How can I set the timeout?
toggleModalLoading();
$("#ele").load('http://site./script.php',{
'data' : postData },
function(e) {
toggleModalLoading();
});
Share
Improve this question
asked Oct 4, 2012 at 19:26
user974896user974896
1,8134 gold badges30 silver badges48 bronze badges
2 Answers
Reset to default 4The .load()
call is really just a convenient shorthand. You could set global ajax options before the .load()
call. If that's not viable, you'll have to use the lower-level API. Either way, you want the timeout
ajax option:
$.ajax('http://site./script.php', {
data: postData,
timeout: 1000, // 1000 ms
success: function (data) {
$('#ele').html(data);
toggleModalLoading();
}
});
set the timeout for the Ajax calls.
$.ajaxSetup({
timeout: 30000
});
If the server is causing it to stop, look at the settings in the php ini file.
本文标签: javascriptSetting timeout jQueryload()Stack Overflow
版权声明:本文标题:javascript - Setting timeout jQuery.load() - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743950471a2567196.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论