$.get('jobs', {
}, function (responseText) {
rt = JSON.parse(responseText);
console.log(rt);
for (i = 0; i < rt.length; i++)
{
$("#jobs").append("<tr><td><div id='progressbar"+i+"' class='progressbar'></div></td></tr>");
pval = (rt[i][2] / rt[i][1]) * 100;
$("#progressbar"+i).progressbar({
value: pval,
max: 100
});
}
});
I have written this code to make progressbar on a td of each row of a table. When i was doing it for 1 row it worked fine, but after I've added multiple rows in my Db, the values are not coming to be accurate.
even when value of pvalis 100, it is filling like 1/4th of the progress bar.
I was unable to replicate the issue. You may want to edit your post and include more details, example data, and any errors generated by Console.
I created the following test: https://jsfiddle.net/Twisty/0v4q5a8z/
HTML
JavaScript
This test works as expected. Your code could be less intense. The function could be: