aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.autocomplete.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-08-24 21:41:34 -0400
committerScott González <scott.gonzalez@gmail.com>2010-08-24 21:41:34 -0400
commitda2be6a2af88ab6e81cc64282abcc1c2703c43bb (patch)
tree5916af09853db0a4e54c3944e00fd5ed2d0b7f35 /ui/jquery.ui.autocomplete.js
parentf115b48d2bd79aff1f65fb895d1ebc9517d82edc (diff)
downloadjquery-ui-da2be6a2af88ab6e81cc64282abcc1c2703c43bb.tar.gz
jquery-ui-da2be6a2af88ab6e81cc64282abcc1c2703c43bb.zip
Autocomplete: Abort existing ajax requests when running new searches.
Diffstat (limited to 'ui/jquery.ui.autocomplete.js')
-rw-r--r--ui/jquery.ui.autocomplete.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 6b19c4401..e8796e41e 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/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 {