Help doing ajax requests in a loop

Help doing ajax requests in a loop

Hi, I am attempting to chain $.post ajax calls pulling the call from an array each time.

  1.         <script>
  2.         var reports = new Array();       
  3.         var parts = <?=$n?>;
  4.         var rowsPerPart = <?=$items_per_call?>;
  5.         var url = "/ajax/report_show.php";
  6.         var data = <?=json_encode($report);?>;
  7.         var html = "";
  8.         
  9.         for(i=0;i<parts;i++){
  10.             reports[i] = {
  11.                 part    : i,
  12.                 end     : i*rowsPerPart,
  13.                 start   : (this.end-rowsPerPart)+1,
  14.                 fetch   : function(callback){
  15.                     $.post(url, {reportInfo:data, start:this.start, end:this.end},        function(data){
  16.                         html = html+data;
  17.                         alert("fetched part "+i);
  18.                         this.callback = callback;
  19.                     }, "html")
  20.                 }
  21.             };
  22.         }
  23.         
  24.         reports.forEach(function(report){
  25.             report.fetch(function(){
  26.                 
  27.             })
  28.         })
  29.     </script>

Where I am struggling is javascript is not my strongest language (thank scientists for jquery)

I have all the report parts in an array with a fetch method on each one that will grab the data, I would usually use the $.post call back to run the next ajax call when this one returns a success. Only the amount of times I want this to run is a variable dependant on other things (var parts = 12 so in my example it would run 12 times each time gettig the next bit of html from the ajax page, this is where the start and end variable comes in (around 5meg or more of data per part so it is timing out and causing an internal server error if I do it all at once)). The idea is to add a progress bar showing how it is doing at grabbing all the data, once it hits 100% I will display it (so after I have run the loop 12 times and retrieved the 12 parts (it won't always be 12 this is dependant on the size of the report)) 

I really not sure how to go about it, I come up with this code from examples I have found around the internet - but I have a feeling I am going around it the wrong way.

Thanks in advance
TJ