I am trying to use the EasyAutoComplete plugin to search a json file. I only want to call the service once to search the json.
$( document ).ready(function() {
var player_values = (function () {
var json = null;
$.ajax({
'async': false,
'global': false,
'url': "http://127.0.0.1:5000/players",
'dataType': "json",
'success': function (data) {
json = data;
}
});
return json;
})();
console.log(player_values);
var options = {
data: player_values,
getValue: "Player",
list: {
match: {
enabled: true
}
}
};
$("#search-team1").easyAutocomplete(options);
});
When match: enabled is false, the dropdown shows the first 5 items in the json when I type. When match:enabled is true, I get the error:
jquery.easy-autocomplete.min.js:10 Uncaught TypeError: a.search is not
a function
at Object.method (jquery.easy-autocomplete.min.js:10)
at f (jquery.easy-autocomplete.min.js:10)
at e (jquery.easy-autocomplete.min.js:10)
at a.proccess (jquery.easy-autocomplete.min.js:10)
at a.ListBuilderService.processData (jquery.easy-autocomplete.min.js:10)
at b (jquery.easy-autocomplete.min.js:10)
at HTMLInputElement.<anonymous> (jquery.easy-autocomplete.min.js:10)
at HTMLInputElement.dispatch (jquery.min.js:3)
at HTMLInputElement.r.handle (jquery.min.js:3)
I've seen other posts with a similar error which was caused by multiple jquerys loading, but I don't think that's my problem. Thanks for your help.