我完成了同步ajax请求,我想显示图像
<div id='loadingmessage' style='display:none'>
<img src='images/ajax-loader.gif'/>
</div>
带有请求的javascript
$.ajax({
type: "POST",
beforeSend : function(){
$('#loadingmessage').show(); // show image..
},
url: "get_surrounding.php",
data: SendData,
cache: false,
processData: false,
contentType: false,
async: false
}).done(function (data2) {
$('#loadingmessage').hide(); // hide image
newPopup('show_surrounding.php',data2);
});
这适用于Firefox,但不是chrome,任何解决方法?
答案 0 :(得分:1)
在ajax调用之前加载它。
$('#loadingmessage').show();
$.ajax(...);