Progress bar not loading to 100%

Progress bar not loading to 100%

Hi,

I'm trying to load the progress bar to 100% but loads up to 62% and executes rest of the code without waiting  can you please suggest.
below is the hierarchy that I want to run
1. Progress bar starts loading- ($('#progressbar').is(':visible')) 
2. Set time interval
3. location.reload to reload the front end
4. close load function
5. prepare dirt should execute.



function completeLoad()
{
var qryComplete=$("#qryComplete").val();
var loadingComplete=$("#loadingComplete").val();
if(loadingComplete==qryComplete && qryComplete=='Y')
{
function testLoad() {
if ($('#progressbar').is(':visible')) 
{
setTimeout( testLoad, 3000 );
location.reload();
}

                closeLoad();
prepareDirt();
}
}