-3
我需要獲取超過500 records.So我需要的,直到所有數據被取出加載圖像符號?我用AJAX從MYSQL數據庫獲取數據如何在我的瀏覽器完全加載動態內容之前加載圖像?
我需要獲取超過500 records.So我需要的,直到所有數據被取出加載圖像符號?我用AJAX從MYSQL數據庫獲取數據如何在我的瀏覽器完全加載動態內容之前加載圖像?
如果你正在使用AJAX,那麼你可以實現beforeSend,嘗試這
$.ajax({
url:'',
data:{
},beforeSend:function(xhr){
// some image in a div box
$('.some-image').show();
},success:function(data){
// your code goes here to display data
$('.some-image').hide();
}
});
希望這個幫助。
試試這個
$('.record').live('click', function() {
var ajaxurl="test.php";
$.ajax({
type:"POST",
url:ajaxurl,
data:'&test='+1,
beforeSend:function(){
$('.cf_loader').html('<p class="cf_load"></p><p class="cf_result">Fetching new result</p>').css('display','block');
},
success:function(response){
$('.cf_loader').hide();
}
});
});
什麼你到目前爲止已經試過? – Hassaan
當你在這行之後調用你的AJAX,就像這樣寫$(「loadingImageId」)。show();並在成功後$(「loadingImageId」)。hide(); –
我想這可能幫助http://code.tutsplus.com/tutorials/how-to-create-infinite-scroll-pagination--wp-24873 –