title: ajax php foreach loop update after each iteration
body: <p>What I am trying to do is is use jQuery/Ajax to make a request to a PHP script and return a status update each time the <code>foreach</code> loop completes. I want to use the output to make a progress bar.</p>
  
  <p>The problem I am having is the jQuery will only update the page once the whole script has completed. Is there a way to force either the jQuery or PHP to output on every loop and not just dump all of it on <code>success</code> function.</p>
  
  <pre><code>        jQuery(document).ready(function($) {            
              $(document).on('click','#fetch-snowfall-data a',function () {
                $(this).text('Fetching Snowfall Data...');
                  $.ajax({
                      type: "GET",
                      async: true,
                      url: "url.php",  
                      data:{},                
                      dataType: "html", 
                      success: function(response){
                          $("#response_container").append(response);
                          $('#fetch-snowfall-data a').text('Fetch Snowfall Data');
                      }
                  }); 
              return false;
              });
          });
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>foreach ( $results['resorts'] as $resort ) {
  
      //Do all the things here
  
      $count++;
      echo $count .'/'. $results['total_rows'];
  
  }
  </code></pre>