title: Jquery ajax request on focusout and enter
body: <p>I want to request a ajax query when focus on input field is lost or when the user hits enter in the input field.</p>
  
  <p>I have following code for doing so</p>
  
  <pre><code>function editVK() {
      var input = $('.check_vk');
      input.keydown(function () {
          // DO some markup
      }).focusout(function () {
          // execute ajax in function
          calculateVolleKist($(this));
          return false;
      }).on('keypress', function (e) {
          var code = (e.keyCode ? e.keyCode : e.which);
          if (code == 13) {
             // execute ajax in function   
             calculateVolleKist($(this));
             return false;
          }
      });
  }
  
  function calculateVolleKist(elem) {
      var regel = elem.closest("tr");
      var article_id = regel.attr('data-article_id');
      var basket_id = regel.attr('data-basket_id');
      var vk = parseFloat(formatToDecimal(elem.val()));
  
      $.ajax({
          url: 'beltramibasket.php?action=wijzig_volle_kist&amp;basket_id='+basket_id+'&amp;article_id='+article_id+'&amp;vk='+vk,
          type: 'GET',
          dataType: "html",
          async: true,
          success: function(data) {
              $('.basket_body').html("");
              $('.basket_body').html(data);
              editVK();
          }
      });
  }
  </code></pre>
  
  <p>When using this code, my first change in the input fires 1 request. My second change fires 2 request, my 3 request fires 4 request and so on unit my browser chrashes. </p>
  
  <p><strong>EDIT</strong>
  Included 2nd function. My response is HTML , I clear the body and put html back into the body. After that I execute the function editVK again. Because I want to trigger other request when editing the input box.</p>