1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
$.ajax({
url: "../controleurs/get_liste_service.php",
type: "POST",
success: function(response) {
var services=$.parseJSON(response);
var nbre=services.length;
console.log("Nbre de service : "+nbre);
//initialisation de la barre de progression
$('#progress_service').attr('aria-valuemax', nbre);
$('#progress_service').css('width', '0%').attr('aria-valuenow', '0');
var resultats="";
for (i=0;i<nbre;i++)
{
console.log(services[i][3]+":"+services[i][4]);
if(services[i][4]>0 && services[i][4]!="")
{
$.ajax({
url: "../controleurs/controle_ad_service.php",
type: "POST",
async: false,
data: {
idgrh:services[i][4],
},
success: function(reponse) {
var result = $.trim(reponse);
console.log(services[i][3]+" : "+result);
if (result == "1") {
//service trouvé
console.log(services[i][3]+" : trouvé");
$("#result_service").append('<div class="alert alert-success" role="alert"><strong>'+services[i][3]+'</strong> - Correct<button class="btn btn-danger btn-sm" type="button" style="float:right">Résoudre</button></div>');
}
else
{
//service manquant
console.log(services[i][3]+" : manquant");
$("#result_service").append('<div class="alert alert-danger" role="alert"><strong>'+services[i][3]+'</strong> - Le service n\'existe pas dans l\'AD<button class="btn btn-danger btn-sm" type="button" style="float:right">Résoudre</button></div>');
}
$('#progress_service').css('width', ((i+1)*100/nbre)+'%').attr('aria-valuenow', i+1);
},
error: function (error) {
console.log(error);
$("#result_service").append(JSON.stringify(error)+"<br><br><br>");
}
});
}
}
}
}); |
Partager