title: jQuery timeout: e.nodeName is undefined
body: <pre><code>&lt;script type="text/javascript"&gt;
  
   var delay = (function() {
       var timer = 0;
       return function(callback, ms) {
           clearTimeout(timer);
           timer = setTimeout(callback, ms);
       };
   })();
  
   $(function() {
  
  
  
       $('#activity').change(function() {
           $(this).val() == "SID" ? $('.SIDContainer').show() : $('.SIDContainer').hide();
       });
  
       $('.SID').keyup(function() {
  
       delay(function() {
  
           $.ajax({
               url: '../SentinelOperationsUI/GenericHandler.ashx',
               data: { 'SID': $(this).val() },
               dataType: 'json',
               success: function(data) {
  
                   if (data.SID != null) {
                       $('.SIDResult').text('Match: ' + ' SID: ' + data.SID);
                       console.log(data);
                   }
               }
  
           });
  
       }, 500);
  
       });
  
  
  
   });
  </code></pre>
  
  <p></p>
  
  <p>The code works without the delay function. But i want a delay here because otherwise multiple ajax request might be sent for the same value (if you type fast enough). Any idea what might be causing this? Any other solutions on this problem maybe? Thanks</p>