Hi, I would like to ask some help on calculating the progress bar percentage,. I never done this before and I have no idea how to accomplish this…I like to create progressbar using the bootstrap progress bar my only problem is that I don’t know how to calculate the percentage if i am requesting data via ajax…and it will stop to 100% if the data is finished loaded.can you help me on this please.
let me rephrase ,I have data requested to the server via ajax and I have something to do with the data being requested from the server…I want to show progressbar to represent what is happening in the background,if the data is done processing in the background the progressbar will stop to 100%…is there a formula on this to show something like this , 1%,2%,3% …etc…until it reached to 100%?
The formula to calculate the size of your progress-bar is very basic: $download_size / $download_progress * $max_progressbar_width. You just need to make sure that both download sizes use the same units to get a correct proportion.
so if the length of the data which is being returned from the server is 97 and the width of my progessbar div is 400px;,but i am confuse with the
$download_progress
97/ ? * 400 // I don’t know what values should i replace in the question mark.
And the progressbar did not animate…
var progress = setInterval(function() {
var x=10;
var $bar = $('.bar');
if ($bar.width()==400) {
clearInterval(progress);
$('.progress').removeClass('active');
} else {
$bar.width(97/ $bar.width() * 400);
}
$bar.text($bar.width() + "%");
}, 800);
Did you get this working?
Did I understand you correctly that you want a progress bar that displays the progress of retrieving data from a remote server?
The data is already finished loaded,and I have something to do with the data,… I have function to convert the data and i want to show progressbar while my function are still processing converting the data…just like when you install software in your p.c there is a progressbar shows percentage…is this possible?
I downloaded the code from the link you sent me, but I’m not sure what I’m looking at.
Your original question was how to display a progress bar when you were reverse-gecoding addresses.
I couldn’t pinpoint this code within the files I downloaded and I don’t want to have to go sifting through your numerous includes.
What I am really after is a short, concise example of the problem you are having.
This is also known as a SSCE (Short, Self Contained, Correct (Compilable), Example):
Short (Small) - Minimise bandwidth for the example, do not bore the audience.
Self Contained - Ensure everything is included, ready to go.
Correct - Copy, paste, (compile,) see is the aim.
Example - Displays the problem we are trying to solve.
If you want to send me the code (instead of post it here), that is fine.