jQuery $.get在IE8下的同步问题

时间:2022-03-11 13:33:17

// $("#imgSpan")是个进度条gif图片
// url返回数据大概用时4到5秒
function syncToGroup(){
    $("#imgSpan").show();
    $.ajaxSetup({async:false});
    $.get("${ctx}/group!callProcedure.action",function(result){
        if(result == "0"){
            alert("同步完成");
        }else{
            alert("同步异常:"+result);
        }
    });
    $.ajaxSetup({async:true});
    $("#imgSpan").hide();
}

以上代码,在IE8下,图片没有首先显示出来,而是当alert弹出来的时候才显示。但在FireFox下,可以得到预想的效果。
向大家求教如果解决,谢谢!

5 个解决方案

#1


$.ajax({
beforeSend: function(){
 $("#imgSpan").show();
}
})

#2


$("#imgSpan").show();
只写这个能显示吗

#3


+1
引用 1 楼  的回复:
$.ajax({
beforeSend: function(){
 $("#imgSpan").show();
}
})

#4


各位大虾,我这样做了,在IE8下还是不可以。 jQuery $.get在IE8下的同步问题
把代码改成如下,也还是不行。

$.ajax({
url: "${ctx}/lidm/view_indresult_org!callProcedure.action",
async: false,
type: "GET",
beforeSend: function(){
$("#img_loading").show();
},
success: function(result){
if(result == "0"){
alert("同步完成");
}else{
alert("同步异常:"+result);
}
},
complete: function(){
$("#img_loading").hide();
}
});

#5


自己把问题解决了!

function syncToGroup(){
$("#imgSpan").show();
$.get("${ctx}/lidm/view_indresult_org!callProcedure.action",function(result){
if(result == "0"){
$("#imgSpan").hide();
alert("同步完成");
}else{
$("#imgSpan").hide();
alert("同步异常:"+result);
}
});
}

#1


$.ajax({
beforeSend: function(){
 $("#imgSpan").show();
}
})

#2


$("#imgSpan").show();
只写这个能显示吗

#3


+1
引用 1 楼  的回复:
$.ajax({
beforeSend: function(){
 $("#imgSpan").show();
}
})

#4


各位大虾,我这样做了,在IE8下还是不可以。 jQuery $.get在IE8下的同步问题
把代码改成如下,也还是不行。

$.ajax({
url: "${ctx}/lidm/view_indresult_org!callProcedure.action",
async: false,
type: "GET",
beforeSend: function(){
$("#img_loading").show();
},
success: function(result){
if(result == "0"){
alert("同步完成");
}else{
alert("同步异常:"+result);
}
},
complete: function(){
$("#img_loading").hide();
}
});

#5


自己把问题解决了!

function syncToGroup(){
$("#imgSpan").show();
$.get("${ctx}/lidm/view_indresult_org!callProcedure.action",function(result){
if(result == "0"){
$("#imgSpan").hide();
alert("同步完成");
}else{
$("#imgSpan").hide();
alert("同步异常:"+result);
}
});
}