Typeahead功能不起作用

时间:2014-08-07 19:57:44

标签: javascript jquery twitter-bootstrap typeahead

所以我正在尝试为我的网站实现一个预先输入功能,但在尝试了各种各样的东西之后,我把问题缩小到了这个问题,即它没有响应字段中的输入。这是我现在的代码:

<input id="typeahead" class="typeahead" data-provide="typeahead" type="text" placeholder="Search ..">

<script type="text/javascript">
                    $(function() {
                        $('#typeahead').typeahead({
                            source: function(query, process){
                                $.ajax({
                                    url: 'php/functions/getSearchResults.php',
                                    type: 'POST',
                                    data: 'query=' + query,
                                    dataType: 'JSON',
                                    async: true,
                                    success: function(data) {
                                        console.log(data);
                                    }
                                });
                            }
                        });
                    });
                </script>

没有任何反应。这些是我加载的脚本:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap.js"></script>

我缺少什么?谢谢!

0 个答案:

没有答案
相关问题