How to update the data source in typeahead in JS?

I have been trying to update the datasouce but not able to do so.

   <input  id="supplierNumberSearch" type="text"  />

I have code written in JS which are as follows :

$('#supplierNumberSearch').typeahead({
        name: 'all-suppliers',
        prefetch: {
            url: '/Supplier/GetAllSuppliersJSON',
            ttl: 0
        },
        template: '<p><strong>{{value}}</strong> - {{text}}</p>',
        engine: Hogan,
        minLength: 0,
        limit: 50,
        highlight: true
    }).on('typeahead:selected', onAutoCompleteSelected)
    .on('typeahead:onTypeAheadComplete', onAutoCompleteSelected);

But my datasource doesnt change.

I am taking help from below :

Update or change typeahead data

But I am not able to update the datasouce. Can some one please help

Source: Ask Javascript Questions

LEAVE A COMMENT