title: Avoid previous ajax request on calling the same ajax request again in jquery
body: <p>I want to avoid previous ajax request on calling the same ajax request again in jquery</p>
  
  <pre><code>&lt;input type="text" id="username" onkeyup = "userName(this)" &gt;
  
  
  
  function userName(e) {
      $.ajax({
          type:"POST",
          url:BasePath + "/users/userName",
          data:"name=" + $.trim($(e).val()),
          success:function (resp) {
          if (resp == 1) {
              $('#div.error_message').html('Username already taken...').show();
          } else {
              $('#div.error_message').hide();
          }
          }
      });
  }
  </code></pre>