I use this plugin.
The HTML element is:
<input class="form-control typeahead" maxlength="50" id="secondname" required="required" name="secondname" type="text">
$("#secondname").typeahead({
minLength: 3,
async: true,
source: function (query, process) {
return fetchPatientForm({ secondname: query })
.then((res) => res.data)
.then((data) => {
console.log(data);
return process(data);
});
},
});
The response in
console.log(data);
is:
[{id: 39, name: 'Михаил', secondname: 'Попов', patronymic: '3' }];
So there are no errors and result too. What do I do wrong?
I have tried to return plain array from server like [1, 2, 3] it also does not work