小编use*_*453的帖子

Bootstrap typeahead在MVC 5中不起作用

在我的mvc项目中,我试图实现自动完成但它不工作(打字头)我做的一切正确,但无法得到它.下面是我的代码.可以任何人帮助

<script type="text/javascript">
$(document).ready(function () {

    $("#Search").typeahead({
        source: function (query, process) {
            var countries = [];
            map = {};

            // This is going to make an HTTP post request to the controller
            return $.post('/Registration/GetPossibleLocations', { query: query }, function (data) {

                // Loop through and push to the array
                $.each(data, function (i, country) {
                    map[country.Name] = country;
                    countries.push(country.Name);
                });

                // Process the details
                process(countries);
            });
        },
        updater: function (item) {
            var selectedShortCode = map[item].ShortCode;

            // Set the text to our …
Run Code Online (Sandbox Code Playgroud)

javascript asp.net-mvc jquery bootstrap-typeahead twitter-bootstrap-3

0
推荐指数
1
解决办法
6275
查看次数