Tokeninput AutoComplete

0

I'm trying to use the Tokeninput API autocomplete by getting values from a controller, but I'm not getting it to work. Can anyone help me?

Follow my code:

<script type="text/javascript" src="~/scripts/js/jquery.tokeninput.js"></script>
<input class="form-control form-control-sm" id="cidadesParadas" type="text" />

    var municipios = new Array();

window.onload = function listaMunicipios() {
    var url = "@Url.Action("ListaMunicipios", "Municipio")";

    $.post(url, function (data) {
        for (var i = 0; i < data.length; i++) {
            municipios.push(data[i].DescMunicipio);
        }
    });
}

    $(document).ready(function () {
    $("#cidadesParadas").tokenInput(municipios);
});
    
asked by anonymous 06.03.2018 / 14:43

0 answers