我需要获取超过500条记录。所以我需要加载一个图像符号,直到所有的数据被获取?我使用ajax从MYSQL数据库获取数据
如果你正在使用ajax,那么你可以实现beforeend,试试这个
$.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();
}
});
try this
$('.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();
}
});
});