2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2025-02-03 12:28:31 +00:00

Abort ajax request on blur, fixes #357

This commit is contained in:
Tomas Kirda 2015-05-03 18:29:39 -05:00
parent 08c284c00d
commit d7b487cc73

View File

@ -217,6 +217,14 @@
onBlur: function () {
this.enableKillerFn();
},
abortAjax: function () {
var that = this;
if (that.currentRequest) {
that.currentRequest.abort();
that.currentRequest = null;
}
},
setOptions: function (suppliedOptions) {
var that = this,
@ -256,9 +264,7 @@
var that = this;
that.disabled = true;
clearInterval(that.onChangeInterval);
if (that.currentRequest) {
that.currentRequest.abort();
}
that.abortAjax();
},
enable: function () {
@ -573,9 +579,7 @@
that.suggest();
options.onSearchComplete.call(that.element, q, response.suggestions);
} else if (!that.isBadQuery(q)) {
if (that.currentRequest) {
that.currentRequest.abort();
}
that.abortAjax();
ajaxSettings = {
url: serviceUrl,