mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-04-20 03:02:41 -04:00
Autocomplete: Abort existing ajax requests when running new searches.
This commit is contained in:
6
ui/jquery.ui.autocomplete.js
vendored
6
ui/jquery.ui.autocomplete.js
vendored
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user