Skip to content
Snippets Groups Projects
Commit 42bfe425 authored by Kevin Abel's avatar Kevin Abel
Browse files

Allow a cancelled directoy request to abort the pending XHR

parent b78b5f23
No related branches found
No related tags found
1 merge request!1WDN 4.0 Theme
......@@ -82,6 +82,9 @@
};
Directory.prototype.cancelSearch = function() {
this._searchCanceled = true;
if (this._xhr) {
this._xhr.abort();
}
};
Directory.prototype.execute = function(q) {
var cacheData = this._cache.get(q),
......@@ -92,7 +95,7 @@
if (cacheData) {
this._render(cacheData);
} else {
$.get(this._server + '/service.php?q=' + encodeURIComponent(q), function(data) {
this._xhr = $.get(this._server + '/service.php?q=' + encodeURIComponent(q), function(data) {
self._cache.save(q, data);
self._render(data);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment