title: How do I show the print with AJAX/jQuery?
body: <p>So I'm trying to understand this whole AJAX/jQuery thing. Right now, when I run this PHP script alone, I would have to wait and watch the wheel spin until it's done with the loop and then it will load.</p>
  
  <pre><code>while ( $row = mysql_fetch_array($res) ) {
      postcode_to_storm( $row['Test'] );
  
      $dom = new DOMDocument();
      @$dom-&gt;loadHTML($result);
      $xPath = new DOMXPath($dom);
  
      $failInvite = 'Rejected';
      $findFalse = strpos($result, $failInvite);
  
      if ( $findFalse == true ) {
          $array[$i] = $row['Test'];
          $i++;
          echo $array[$i]};
      } 
  
  }
  </code></pre>
  
  <p>Now, how do I use AJAX/jQuery to show <code>echo $array[$i]};</code> everytime it is invoked instead of waiting for the whole process to complete?</p>