I know that the above can be achieved using quietMillis in an AJAX call, but I use a query to cache data. And here I can not defer AJAX call. Below is the code
$('#AssetType').select2({ cacheDataSource: [], placeholder: ' ', quietMillis: 3000, query: function q(query) { self = this; var key = query.term; var cacheData = self.cacheDataSource[key]; if (cacheData) { query.callback({ results: $.map(cacheData, function (item) { return { text: item.LongDescription, id: item.AssetTypeID } }) }); return; } else { $.ajax({ url: 'http://localhost:52377/api/reference/asset/types/' + key, dataType: 'json', type: 'GET', quietMillis: 3000,
Is there any work to delay an AJAX call so that the AJAX call does not start for every keystroke? The reason for using the βrequestβ is caching, which is not possible by simply setting the cache to true in an AJAX call.
source share