为什么typeahead不显示结果?

问题描述 投票:0回答:0

我用这个插件.

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] 它也不起作用

jquery typeahead.js typeahead
© www.soinside.com 2019 - 2024. All rights reserved.