R
while (index<counter)
{
$.ajax({
url: "/suggestions",
type: "get",
data: {pagetoken:pagetoken_, usertoken:usertoken_, adstoken:adstoken_, parentbm:parentbm_, proxy:proxy_},
beforeSend: function() {
$('.progress-bar').css('width', (100/counter)*(progressbarindex+1) +'%');
progressbarindex++;
},
success: function(response) {
var resp = response;
if (resp.includes("Error")){
$.growl({ title: "Ошибка", message: resp });
}
else{
var t = $('#example').DataTable();
t.row.add( [
resp[0].split(';')[0],
resp[0].split(';')[1],
resp[0].split(';')[2],
resp[0].split(';')[3]
] ).draw( false );
}
},
error: function(xhr) {
$('#run').removeClass('disabled');
}
});
index++;
if (index==counter){
$('.progress-bar').css('width', 0 +'%');
}
}