title: Destroying/creating jquery autocomplete
body: <p>Is there no way to cancel a jQuery autocomplete ajax call when the input loses focus? I've concluded that I need to A) destroy the autocomplete (and remove the 'ui-autocomplete-loading' class) on blur and B) create the autocomplete on focus. My code, which works fine to do that:</p>
  
  <pre><code>            $('#myinput').focus(function(){
                  $('#myinput').autocomplete({
                      delay: 250,
                      source: function(request, response) {
                          $.ajax({
                              url: "cfc/myfunctions.cfc?method=lookup&amp;returnformat=json",
                              dataType: "json",
                              data: {
                                search: request.term,
                                maxRows: 20
                              },
                              success: function(data) {
                                response(data);
                              }                   
                          })
                      },
                      change: function(event, ui) {     
                          if (!ui.item) {
                              $(this).val('');
                          }
                      }
                  });
              });
  
              // necessary to cancel autocompletes if the user leaves the input or closes the filter
              $('#myinput').blur(function(){
                  $(this).removeClass('ui-autocomplete-loading').autocomplete('destroy');
              });
  </code></pre>
  
  <p>This has the expected behavior of cancelling the autocomplete (and removing the loading.gif icon) on blur and enabling the autocomplete when the input gets focus.</p>
  
  <p>What gets weird is when the user does this while the autocomplete is taking a long time to respond. In this case, I have an autocomplete which takes as long as 20 seconds to respond at times (yes, I know, that's another issue). If the user types in a value, clicks somewhere else, and goes back to have another stab at the autocomplete, the new call is made, the new loading icon is shown, and the first ajax call is still churning away in the background. When the first ajax call completes, even though that instance of autocomplete has been destroyed, the callback removes the 'ui-autocomplete-loading' class of the CURRENT instance, and the icon disappears, even though the current autocomplete is still churning away behind the scenes.</p>
  
  <p>Is there really no other way to cancel the autocomplete, or better yet, to cancel the underlying ajax call? </p>