返回结果未提前显示

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

我已经阅读了有关stackoverflow上此帖子的所有解决方案,但都没有解决我的问题,

我已经成功实现typeahead.js,但是我得到了正确的结果,但是结果没有显示在下拉列表中。

<input type="text" name="suggest" id="suggest" class="form-control input-lg" autocomplete="off" placeholder="type your message">

$(document).ready(function() {

    $('#suggest').typeahead({
        source: function(query, result) {
            $.ajax({
                url: "https://chat.synetal.com/Suggestion/getMsg",
                method: "POST",
                data: {
                    query: query
                },
                dataType: "json",
                success: function(data) {
                    result($.map(data, function(item) {
                        return item;
                    }));
                }
            })
        }
    })
});
javascript typeahead.js
1个回答
0
投票
我已经使用jquery自动完成功能完成了此操作

From this URL i have completed this and its easy to impletment

© www.soinside.com 2019 - 2024. All rights reserved.