function loading(url,data,loadingText,func){
$.ajax({
type:'POST',
url:url,
data:data,
//dataType:'json',
success:function(msg){
$('#loading').html(msg);
if ('function' == typeof func) func();
},
error:function(XMLHttpRequest, textStatus, errorThrown){
$('#loading').html('出错了,错误为:'+textStatus+','+errorThrown+'<br />三秒后自动刷新页面');
setTimeout('location.reload()',3000);
}
})
$.ajax({
type:'POST',
url:url,
data:data,
//dataType:'json',
success:function(msg){
$('#loading').html(msg);
if ('function' == typeof func) func();
},
error:function(XMLHttpRequest, textStatus, errorThrown){
$('#loading').html('出错了,错误为:'+textStatus+','+errorThrown+'<br />三秒后自动刷新页面');
setTimeout('location.reload()',3000);
}
})
}
loading('sync/sites',{seoOnly:true},'正在同步,请耐心等待...',function(){setTimeout('location.reload()',5000)});
此博客展示了如何使用JavaScript实现网站数据同步,并在遇到加载错误时进行处理,包括展示错误信息和自动刷新页面。
1465

被折叠的 条评论
为什么被折叠?



