ajax后刷新页面 [英] refresh page after ajax
本文介绍了ajax后刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在上传ajax之后刷新iframe大约2秒后显示加载div
但是我无法设置ajaxstop函数的超时
i need to refresh the iframe after upload ajax about 2 seconds after it shows loading div but i can't set timeout for ajaxstop function
是有没有办法做到这一点?
is there any way to do this?
$('form').ajaxForm({
beforeSend: function() {
status.empty();
var percentVal = '0%';
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
$("#progressbar").progressbar({
value: percentComplete
});
$('#porcentagem').html(percentVal);
if(percentComplete == 100){
$('#wait').remove();
}
},
complete: function() {
setTimeout(function(){
$('#conteudo_upload').hide();
$('#loading').show();
}, 800);
setTimeout(function(){
$(document).ajaxStop(function(){
window.location.reload();
});
}, 1000);
}
});
推荐答案
试试这个:
$('form').ajaxForm({
beforeSend: function() {
status.empty();
var percentVal = '0%';
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
$("#progressbar").progressbar({
value: percentComplete
});
$('#porcentagem').html(percentVal);
if(percentComplete == 100){
$('#wait').remove();
}
},
complete: function() {
setTimeout(function(){
$('#conteudo_upload').hide();
$('#loading').show();
}, 800);
setTimeout(function(){
window.location.reload();
}, 1000);
}
});
这篇关于ajax后刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文