title: Handle ajax call on keypress
body: <p>I am using PHP codeigniter 3. For select box I am using jquery ajax call where I retrieve values from database and append them to select drop down. on each key press ajax is called.But it is making process slow after keypress user have to hold to press next key. How I can make process fast so that user can input data normally. I am using <strong>async:false</strong> </p>
  
  <pre><code>    $.ajax({  
      type:'POST',
      cache:false,
      async:false,
      data: { 'search_val' : search_val },
      url: URL,
      success: function(data)
      { 
          // Code to append
      }
  });
  </code></pre>
  
  <p>For eg User types <strong>a</strong> in auto complete select box then ajax will hit database and will check cities starting with <strong>a</strong> and append list in dropdown. then if he type <strong>u</strong> after <strong>a</strong> then ajax will search for cities starting with <strong>au</strong> so on each keypress ajax will look for data in database  </p>