title: Ajax post is slow
body: <p>I have a page with from, and I maked an input, and when the user is writing, it's automaticlly will show the result from the DB(LIKE SEARCH).
  I used jquery.
  It's working but it's runing very slow.
  Can antbody help me?</p>
  
  <p>The code is:</p>
  
  <pre><code>&lt;html&gt;  
      &lt;head&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;link rel='stylesheet' type='text/css' href='new_style.css' /&gt;
            &lt;script src="jquery.js"&gt;&lt;/script&gt;
  
            &lt;script type='text/javascript'&gt;
                setInterval(function() { 
                    $('.input').keyup(function(){
                        var a = $('.input').val();
                        $.post('select.php?id=28',{"name":a}, function(data){
                            $('#msg').html(data);
                        });
                    });
                },1000);
           &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
  &lt;?php
  if(isset($_GET['id'])){
      if(isset($_POST['name'])){
          $name = $_POST['name'];
          if($_POST['name']==""){
              echo "text";
          } else {
              $query = mysqli_query($user-&gt;getDB(),"SELECT * FROM bla WHERE name  LIKE '%$name%'");
              if(mysqli_num_rows($query)==0){
                  echo "text";
              } else { ?&gt;
          &lt;table id='tables'&gt;
              &lt;tr&gt;
                  &lt;th&gt;name&lt;/th&gt;
                  &lt;th&gt;text&lt;/th&gt;
                  &lt;th&gt;text&lt;/th&gt;
                  &lt;th&gt;text&lt;/th&gt;
              &lt;/tr&gt;&lt;?php
                  while($show =mysqli_fetch_assoc($query)){
                      echo $show['name'];
                  }
              }
              echo "&lt;/table&gt;";
              if(isset($_POST['check'])) {
                  foreach($_POST['ch'] as $selected) {
                      echo $selected . " &lt;br /&gt;";
                  }
              }
          }
      } else { ?&gt;
          &lt;p id='msg'&gt;&lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
      }
  }
  ?&gt;
  </code></pre>