0

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

DDK
  • 1,032
  • 18
  • 39
krafo
  • 183
  • 5
  • 20
  • I believe you are using some plugin, what is the plugin name? i am asking just to verify that the plugin doesn't have a unique way to update the progress bar's value – Silagy Jan 23 '13 at 12:54
  • see http://stackoverflow.com/questions/2474528/showing-progressbar-progress-with-ajax-request and http://stackoverflow.com/questions/9540957/jquery-ajax-loop-to-refresh-jqueryui-progressbar – Rachel Gallen Jan 23 '13 at 12:57
  • @RachelGallen thanks however i didnt find my solution in those questions. the issue reported there is different. my issue is that the progress value is always being 0. – krafo Jan 23 '13 at 13:13
  • I think you mean: `$(document).ready(function(){ setInterval(updateProgressBar, 5000) });` – gen_Eric Jan 23 '13 at 15:38

0 Answers0