title: How to trigger an event in input text after I stop typing/writing?
body: <p>I want to trigger an event just after I stop typing (not while typing) characters in my input textbox.</p>
  
  <p>I've tried with:</p>
  
  <pre><code>$('input#username').keypress(function() {
      var _this = $(this); // copy of this object for further usage
  
      setTimeout(function() {
          $.post('/ajax/fetch', {
              type: 'username',
              value: _this.val()
          }, function(data) {
              if(!data.success) {
                  // continue working
              } else {
                  // throw an error
              }
          }, 'json');
      }, 3000);
  });
  </code></pre>
  
  <p>But this example produces a timeout for every typed character and I get about 20 AJAX requests if I type-in 20 characters.</p>
  
  <p><a href="http://jsfiddle.net/xVBMW/1/">On this fiddle</a> I demonstrate the same problem with a simple alert instead of an AJAX.</p>
  
  <p><strong>Is there a solution for this or I'm just using a bad approach for this?</strong></p>