Cancel previous search autocompletion requests when a new one is sent

feature/core
Sven Slootweg 11 years ago
parent 0599bc2531
commit b6d0d9eb14

@ -200,7 +200,12 @@ SearchCompletionSource.prototype.getItem = function(index) {
} }
SearchCompletionSource.prototype.updateItems = function(query, callback) { SearchCompletionSource.prototype.updateItems = function(query, callback) {
$.ajax({ if(typeof this.request !== "undefined")
{
this.request.abort();
}
this.request = $.ajax({
url: "/autocomplete/search/?q=" + escape(query), url: "/autocomplete/search/?q=" + escape(query),
dataType: "json", dataType: "json",
success: function(result) { this.results = result; callback(); }.bind(this) success: function(result) { this.results = result; callback(); }.bind(this)

Loading…
Cancel
Save