2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-12-26 20:20:12 +00:00

Merge pull request #89 from boriscosic/master

Added: ajax abort
This commit is contained in:
Tomas Kirda 2013-07-17 09:47:10 -07:00
commit 444ed82327

View File

@ -71,6 +71,7 @@
containerClass: 'autocomplete-suggestions',
tabDisabled: false,
dataType: 'text',
currentRequest: null,
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
},
@ -428,7 +429,10 @@
if ($.isFunction(options.serviceUrl)) {
serviceUrl = options.serviceUrl.call(that.element, q);
}
$.ajax({
if(this.currentRequest != null) {
this.currentRequest.abort();
}
this.currentRequest = $.ajax({
url: serviceUrl,
data: options.ignoreParams ? null : options.params,
type: options.type,