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.
1 parent 6bc88a8 commit bad2069Copy full SHA for bad2069
Resources/public/js/select2entity.js
@@ -1,6 +1,8 @@
1
$(document).ready(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),
@@ -38,7 +40,12 @@ $(document).ready(function () {
38
40
}
39
41
} else {
42
// no caching enabled. just do the ajax request
- $.ajax(params).fail(failure).done(success);
43
+ if (request) {
44
+ request.abort();
45
+ }
46
+ request = $.ajax(params).fail(failure).done(success).always(function () {
47
+ request = undefined;
48
+ });
49
50
},
51
data: function (params) {
0 commit comments