We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 623fb50 + bad2069 commit 2a9ebd8Copy full SHA for 2a9ebd8
Resources/public/js/select2entity.js
@@ -1,6 +1,8 @@
1
(function( $ ) {
2
$.fn.select2entity = function (options) {
3
this.each(function () {
4
+ var request;
5
+
6
// Keep a reference to the element so we can keep the cache local to this instance and so we can
7
// fetch config settings since select2 doesn't expose its options to the transport method.
8
var $s2 = $(this),
@@ -39,7 +41,12 @@
39
41
}
40
42
} else {
43
// no caching enabled. just do the ajax request
- $.ajax(params).fail(failure).done(success);
44
+ if (request) {
45
+ request.abort();
46
+ }
47
+ request = $.ajax(params).fail(failure).done(success).always(function () {
48
+ request = undefined;
49
+ });
50
51
},
52
data: function (params) {
0 commit comments