I have this segment in my php script that shows a progress bar.
<?php
    echo '
    <div class="progress progress-xlarge progress-striped active">
        <div id="progress_bar" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" style="width: 90%;"></div>
    </div>
    ';
?>
The width: 90% determines the level of the progress bar.
I want a way to make the progress bar run from 0 to 100 without reloading the page for each iteration. My general ideas is something like.
for($i = 0; $i <= 100; $i++)
    echo '... style="width: $i"...
I know that this will echo a new progress bar for every iteration. It's just a ways to explain what i want. Hope you understand.
I've seen things concerning this like jQuery and Ajax but I can't understand them.
This is the first of this kind of programs i'm writing.
Ive succeeded to make the progress bar move with this script but it runs to fast.
    <script>
$(document).ready(function(){
    for(var i = 0; i < 100; i++)
    {
        $("#progress_bar").attr("style", "width: " + i + "%");
        //setTimeout(function() {}, 2000);   this time out does not work
        //if(i == 99) i = 0; i want the progress bar to start back when complete, 
        //instead the page gets in an infinite loop.
    }
});
</script>
Help with the new changes.