我用这个插件.
HTML 元素是:
<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);
});
},
});
回应
console.log(data);
是:
[{id: 39, name: 'Михаил', secondname: 'Попов', patronymic: '3' }];
所以也没有错误和结果。我做错了什么?
我尝试从服务器返回普通数组,如 [1, 2, 3] 它也不起作用