I would like to update a jquery progress bar value with the value of percentage complete of a particular process. Basically i have the following function:
function updateProgressBar() {
$.ajax({
url: "WebService/DataServices.asmx/getPercentage",
dataType: "text",
type: "POST",
data: {},
success: function (value) {
$("#progress2").html(value);
$("#progress-sample").progressbar({
value: parseInt(value)
});
}
});
}
the function basically make an ajax request to a webmethod getPercentage which calculates the percentage completed. the function is then called every 5 seconds using
$(document).ready(setInterval(updateProgressBar, 5000));
For some reason the progress bar value is not being set when the web app is run. I added a div
with id progress2
and the value is reflected successfully however not the progressbar value. When setting the progress bar value hardcoded it works fine though. Any ideas please?
Thanks