I invoke a WebService method asynchronously.
While the method is not complete, I use that jQuery code to update my progress bar (get progress value from that WebService)
var intervalID = setInterval(updateProgress, 1000);
function updateProgress() {
$.ajax({
type: "GET",
url: "myPage.aspx/GetProgress",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
success: function(msg) {
$("#result").text = msg.d;
var value = $("#progressbar").progressbar("option", "value");
if (value < 100) {
$("#progressbar").progressbar("value", msg.d);
$("#result").text(msg.d);
}
else {
clearInterval(intervalID);
}
}
});
The problem is, that the browser sends the requests (let's say 15 times) to get the progress value, but that requests are waiting while the asynchronous method is complete. Then, my server sends 15 times that value for the browser.
Why requests are waiting to complete the asynchronous method ??