title: php mysql ajax jquery error connection
body: <p>Backstory: I am running a simple jquery ajax script and I am getting a server reset connection error. This happens when I click on the button calling the script but only happens after several clicks.</p>
  
  <pre><code>    function Afunction(){
      var user = $("#div1").text();
      var position = $("#div2").text();
  
  
      $.ajax({
      url: 'script.php',
      type: "POST",
      datatype: "html",
      data: ({x: user, y: position}),
      }).done(function (data) {
              $("div3").html(data);
          }).fail(function (e) {
              //Error handling
      alert("uh oh a problem");
  
       });  
  
  
       }
  </code></pre>
  
  <p>Problem: This code works several times when calling the php script and passing the data to the div, then the server resets for no apparent reason. The error handler alerts the phrase I assume because it can't contact server and retrieve the php script.</p>
  
  <p>I am using Linux hosting. Called my hosting company for help but they didn't have answer.</p>
  
  <p>Request: Looking for anyone who has had this problem. Is it my hosting company? Sorry this is so broad but I have tested and tested with no luck. Here is what I have attempted:</p>
  
  <ol>
  <li>stripped down code to only the above code</li>
  <li>simplified mysql table </li>
  <li>reviewed php script...it works</li>
  <li>called hosting for help...nada</li>
  <li>changed php version to 5.4 </li>
  <li><p>Tried all web browsers. same thing happens</p>
  
  <pre><code>&lt;?php
  
  include('connect.php');
  
  //post the content in the clicked div
  
  $username= $_POST['x'];
  $position= $_POST['y'];
  
  
  
  $query2= "SELECT * FROM table WHERE t.user_name='$username' AND t.position = '$position'";
  
  
  
  $results = mysql_query($query2)or die(mysql_error());
  
   echo '&lt;table class=""&gt;
  
   while($row = mysql_fetch_array($results)) {
     $holder = $row['row'];
  
  
  
   echo '&lt;tr onmouseover="ChangeColor(this, true);" 
        onmouseout="ChangeColor(this, false);" 
        onMouseDown=""&gt;';
   echo '&lt;td style="width: 70%;" &gt;' . $holder . '&lt;/td&gt;';
   echo '&lt;td style="width: 15%;" &gt;' . $holder . '&lt;/td&gt;';
   echo '&lt;td style="width: 15%;" &gt;' . $holder . '&lt;/td&gt;';
  
  
  
   echo "&lt;/tr&gt;";
  
  }
  echo "&lt;/table&gt;";
  
  
  
  mysql_close($connect);
  ?&gt;
  </code></pre></li>
  </ol>