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
|
// Appel AJAX pour récupérer la valeur du pourcentage d'evolution du traitement
function copy() {
$.ajax({
type: "POST",
url: "/WebService/MonWebService/GetPourcentage",
timeout:2000,
complete : function (){
clearTimeout(intervalID);
},
success: function(response){
alert(response);
alert(response.d);
if (response < 100) {
$("span[id$='lblPourcent']").html(response);
}
// poll timer for another trip
TimerCopy();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
//alert('Status : ' + textStatus);
//alert('XMLHttpRequest.status :'+XMLHttpRequest.status);
if(textStatus=='timeout')
{
TimerCopy();
}
}
})
}
// Rappel la fonction au bout de 5 secondes
function TimerCopy() {
intervalID = setTimeout("copy()", 5000)
} |
Partager