Bootstrap-3-Typeahead does not list options

0

I'm using Bootstrap-3-Typeahead plugin that should work simply.

My server-side method is correct, bringing the selection options but not list. From what I read in git, neither does it need extra css, but not list.

Follow my code:

$("#pesquisa").typeahead({
                source: function (query) {
                    return $.get("/Estabelecimento/GetDados", { q: query });
                },
                minLength: 3
            });
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="input-group">
                <input type="text" id="pesquisa" name="pesquisa"  class="form-control typeahead" autocomplete="off" placeholder="Pesquisar" />
                <div class="input-group-btn"><button class="btn btn-primary">Pesquisar</button></div>

            </div>
        </div>
    </div>
</div>

Here is the image of the return of my call:

    
asked by anonymous 16.07.2018 / 22:54

1 answer

0

I do not think you're initializing the data correctly.

 $.get("Estabelecimento/GetDados", function(data) {
      console.log(data);
      $("#pesquisa").typeahead({   
        source: data,
        minLength: 3
      });
    }, 'json');
    
16.07.2018 / 23:30