I retrieve JSON results from the server using Typeahead 0.10 twitter with remote URL.
I want to prevent client caching to stop so that the search is always on the server. How can I do that?
Please see below my code:
// Bloodhound suggestion engine illustration of VAR data source = new Bloodhound ({datumTokenizer: function (e) {return Bloodhound. tokenizers.whitespace (d.value);}, queryTokenizer: Bloodhound.tokenizers.whitespace, remote: {url: "../" + autocompleteInfo.ControllerName + "/" + autocompleteInfo.MethodName + "? term =% QUERY & amp ; ts = "+ (new Date (). GetTime ()), filter: function (res) {var data = []; data = $ Kmap (race, function (item) {return {label: Aitmnam. Id, id: item.Id, autocompleteInfo: autocompleteInfo, cssClass: item.Class};}); return data;}}, range: 15 name: 'typeaheadSourceCache', Itiel: 0, Ajax: {cache: false}}); DataSource.initialize (); $ ( "#" + AutocompleteInfo.AutocompleteId) .typeahead ({MINLENGTH: 3, highlights: True, AutoSelect: true} {displayKey: 'labeled' Source: dataSource.ttAdapter (), templates: {Hint: Handlebars. Compile ('& lt; div class = "searchItem {{cssClass}}" & gt; {{label}} & lt; / div & gt;')}});
See version 10.0.2. Now to clean the cache via Bloodhound.js (done with the help of Typeahead.js) is a tool:
engine.clearRemoteCache ();
Here is the documentation from Twitter TypeHead:
Comments
Post a Comment