在生成内容之前,我正在为div添加加载gif图像。它在Firefox中工作正常,但在Internet Explorer中不起作用。下面是我的代码beforeSend在jQuery中使用ajax时不能在Internet Explorer中工作
感谢堆
<script type="text/javascript">
j(document).ready(function() {
j('#sliderform').submit(function() {
//j('#dash1').html('loading....');
bodyContent = j.ajax({
beforeSend: function(){
$("#dash1").append('abhinab...');
//alert("loading,..");
j('#dash').html('loading....');
j('#dash').html('<img src="../resources/images/loading.gif" >');
//document.getElementById('loading').innerHTML = '<img src="../resources/images/loading.gif" >';
// document.getElementById('dash').innerHTML = '<img src="../resources/images/loading.gif" >';
},
url: "dashboardreload.php",
global: true,
type: "POST",
data: ({min : j("#min").val(),max : j("#max").val()}),
dataType: "html",
async:false,
success: function(msg){
// drawChart();
}
}
).responseText;
//j('#dialog-form').html('');
//j("#dialog-form").dialog("close");
//document.getElementById('dash').innerHTML = '<img src="../resources/images/loading.gif" >';
j('#dash').html(bodyContent);
drawChart();
//confirm(bodyContent);
return false;
});
});
</script>
如果您使用的是jQuery 1.4,那么http://stackoverflow.com/questions/5817238/jquery-ajaxsetup-beforesend-not-executing-in-ie8可能是有趣的。 – GordonM 2011-06-10 11:57:53