Skip to content
Permalink
Browse files

Autocomplete: Abort existing ajax requests when running new searches.

  • Loading branch information...
scottgonzalez committed Aug 25, 2010
1 parent f115b48 commit da2be6a2af88ab6e81cc64282abcc1c2703c43bb
Showing with 5 additions and 1 deletion.
  1. +5 −1 ui/jquery.ui.autocomplete.js
@@ -221,10 +221,14 @@ $.widget( "ui.autocomplete", {
} else if ( typeof this.options.source === "string" ) {
url = this.options.source;
this.source = function( request, response ) {
if (self.xhr) {
self.xhr.abort();
}
self.xhr = $.getJSON( url, request, function( data, status, xhr ) {
if ( xhr === self.xhr ) {
response.apply( this, arguments );
response( data );
}
self.xhr = null;
});
};
} else {

0 comments on commit da2be6a

Please sign in to comment.
You can’t perform that action at this time.