2

How I can cancel the pending request through bloodhound when the keyword is changed ?

    var data = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.whitespace,
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    remote: {
        wildcard: '%QUERY',
        url: $('div.job .typeahead').attr('data-autocomplete-url') + '?term=%QUERY',
        ajax: {
            async: true,
            dataType: 'json',
            crossDomain: true,
        }
    }

});

$('div.job .typeahead').typeahead(null, {
    name: 'job',
    displayKey: 'text',
    limit: Infinity,
    source: data
});
tr.am
  • 295
  • 1
  • 3
  • 11
  • You can change your remote settings a little and acchieve what you want using abort() function. See my answer here: https://stackoverflow.com/a/46959188/3638529 – joalcego Oct 26 '17 at 16:19

0 Answers0