Bootstrap

ajax循环调用到时网页很慢,jquery ajax调用一个接一个循环,而不停止页面呈现

我有一张超过100行的桌子。

每一行由pdf文件及其状态最后一列的描述组成。

状态显示pdf文件是否可读。

处理每个pdf文件需要30秒到1分钟(取决于文件的大小)

我不想使用异步调用并将所有100个请求发送到服务器。

当我使用async=false时。它逐个执行每个ajax调用,这就是我想要做的,

但同时它会停止用户浏览加载的表。所以换句话说,在所有这些ajax请求都完成之前,用户有点卡住了。然后他可以向下滚动阅读更多信息。

我想允许用户阅读网页,而在后台,我想执行一个接一个的ajax请求,以处理pdf文件并更新每行的状态。

$('table.tableRecods tr').each(function(){

fileWithPath = $('#filePath').text();

$this = $(this);

$this.find('td.status img.cropStatus').attr('src', 'img/loader.gif') ;

$.ajax({

url:'jsonCall.php',

async:false,

data: {file: escape(fileWithPath)},

success: function(data){

if(data.status == 'true') {

$this.find('td.status img.readStatus').attr('src', 'img/icons/read.png') ;

}else if(data.status == 'false'){

$this.find('td.status img.readStatus').attr('src', 'img/icons/__read.png') ;

}

}

});

});

;