title: Jquery $.post call to Mysql through PHP gives error: ReadResponse() failed
body: <p>in my application I am using Jquery <code>$.post</code> methods to a PHP page where I am making Mysql DB calls and with the return I am creating divs in a loop, finally returning that to Jquery $.post method and appending the output to HTML div tag. I have 8 different areas and for each area I am using separate Jquery <code>$.post</code> method sending different parameters to that PHP file. Every thing works fine but when I try to refresh the page for 3-5 times(quickly pressing refresh button) the page breaks, if I keep fiddler2 open is shows: </p>
  
  <pre><code>"[Fiddler] ReadResponse() failed: The server did not return a response for this request.Server returned 0 bytes."
  </code></pre>
  
  <p>If fiddler2 is not open then it shows: </p>
  
  <pre><code>"The connection was reset
  The connection to the server was reset while the page was loading."
  </code></pre>
  
  <p>I am using OOP PHP to connect to Mysql, checking if there is a live connection or not, after query execution I am closing the connection as well. Is it because of too many separate calls to server from separate Jquery $.post methods?</p>
  
  <p><strong>Jquery $.post method:</strong></p>
  
  <pre><code>$.post('app_code/pageOperations/homepage.php', {
      articleTypeID: 1, //param for PHP page
      articleDate: today, //var holds today's date, param for PHP page
      position: "body" //param for PHP page
      },
      function(output){                     $("#politicsTop5").html(output);                  
      }
  );
  </code></pre>
  
  <p>I have 8 methods with different data parameters.</p>
  
  <p><strong>PHP code</strong></p>
  
  <pre><code>if($position == "body"){
      $_page_interface = new page_interface();    
      $result = $_page_interface-&gt;getArticleBody( $articleTypeID, $articleDate );
      while($row = $result-&gt;fetch_assoc())
      {       
          echo "&lt;div id='politics'&gt;
          &lt;div class='article-item alert alert-success'&gt;
          &lt;figure class='pull-left'&gt;&lt;img src='".$row['speaker_img_link']."' alt='".$row['speaker_designation']." ".$row['speaker_name']."' /&gt;&lt;/figure&gt;
          &lt;div class='pull-right article-content'&gt;
          &lt;h4&gt;&lt;a href='single_article.php?aId=".$row['article_id']."&amp;typeId=".$row['article_type_id']."' title=''&gt;".$row['article']."&lt;br&gt;- &lt;b&gt;".$row['speaker_designation']." ".$row['speaker_name']."&lt;/b&gt;&lt;/a&gt;&lt;/h4&gt;
          &lt;p class='article-meta'&gt;&lt;b&gt;".$row['TotalUp']."&lt;/b&gt; &lt;i class='icon-thumbs-up'&gt;&lt;/i&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;b&gt;".$row['TotalDown']."&lt;/b&gt; &lt;i class='icon-thumbs-down'&gt;&lt;/i&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;b&gt;".$row['TotalComment']."&lt;/b&gt; &lt;i class='icon-pencil'&gt;&lt;/i&gt;&lt;/p&gt;
          &lt;/div&gt;
          &lt;/div&gt;
          &lt;/div&gt;";
      }
  }
  </code></pre>
  
  <p>All those 8 Jquery methods call this PHP block with different parameters.
  All works fine but after couple of refresh the data won't load. Can any one help me please? Thanks in advance.</p>
  
  <p><strong>PHP code block Edit:</strong></p>
  
  <pre><code>if($position == "body"){
          $_page_interface = new page_interface();    
          $result = $_page_interface-&gt;getArticleBody( $articleTypeID, $articleDate );
          while($row = $result-&gt;fetch_assoc())
          {       
              echo "&lt;div class='politics'&gt;
              &lt;div class='article-item alert alert-success'&gt;
              &lt;figure class='pull-left'&gt;&lt;img src='".$row['speaker_img_link']."' alt='".$row['speaker_designation']." ".$row['speaker_name']."' /&gt;&lt;/figure&gt;
              &lt;div class='pull-right article-content'&gt;
              &lt;h4&gt;&lt;a href='single_article.php?aId=".$row['article_id']."&amp;typeId=".$row['article_type_id']."' title=''&gt;".$row['article']."&lt;br&gt;- &lt;b&gt;".$row['speaker_designation']." ".$row['speaker_name']."&lt;/b&gt;&lt;/a&gt;&lt;/h4&gt;
              &lt;p class='article-meta'&gt;&lt;b&gt;".$row['TotalUp']."&lt;/b&gt; &lt;i class='icon-thumbs-up'&gt;&lt;/i&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;b&gt;".$row['TotalDown']."&lt;/b&gt; &lt;i class='icon-thumbs-down'&gt;&lt;/i&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;b&gt;".$row['TotalComment']."&lt;/b&gt; &lt;i class='icon-pencil'&gt;&lt;/i&gt;&lt;/p&gt;
              &lt;/div&gt;
              &lt;/div&gt;
              &lt;/div&gt;";
          }
      }
  </code></pre>