title: need to create ajax call with abort and time interval
body: <p>I have one SELECT element with a js function refreshme() which will call on change event.</p>
  
  <pre><code>&lt;select id="cat" name="cat" multiple  onchange="refreshme()"&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
    &lt;option value="3"&gt;3&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;div id="result"&gt;&lt;/div&gt;
  
  
  &lt;script&gt;
  function refreshme()
  {
       /* i need output in $('#result').html(data) */
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Here i want to call a URL "demo.php" using ajax when we change select/Unselect listbox item.  Problem is that  when user select item then it calls ajax function immediaterly. I want to set some intermal so that if user select one by one listbox then ajax does not call. I want to setup approx 2 seconds gap. That means ajax call should be call after 2 seconds of last selected item. If user select any other listbox then ajax call be abort if it is running and waiting for result.</p>