/uploads/20230421/a834fc2252e1b4a119d1e04d9d8aaf2e.gif,但不会消失.这让我相信无论是.ajaxStart还是.ajaxStop函数都没有被调用(因为它最初也没有隐藏它).
TIA!
css:
#loadingDiv {
background-image: url('images/loading.gif');
height: 32px;
width: 32px;
margin: 50px auto 50px auto; }
jquery:
<script type="text/javascript">
$(document).ready(function()
{
$('#loadingDiv')
.hide()
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
})
;
$("#results").load("i/getAllInfo.class.PHP"); return false;
};
</script>
解决方法
$("#results").load("i/getAllInfo.class.PHP"); return false;
}); //<----- you need the )
你的网址“i / getAllInfo.class.PHP”看起来不对劲.
尝试在.ajaxStop()中注释掉$(this).hide(),如下所示:
.ajaxStop(function() {
//$(this).hide();
})
因为它可以显示这么短的时间,你不会看到它.
继承人是你的小提琴:http://jsfiddle.net/GrsRT/11/