0

I am using jquery-tokeninput as an autocomplete to retrieve some objects in my app. My js code to initialize the autocomplete is this:

function initialize_search(model, input_busca) {
    var url = reverse('autocomplete.'+model) + "?tipos[]=almoxarifado&tipos[]=estoque";
    var data = $(input_busca).data('tokeninput');
    $(input_busca).tokenInput(url, {
        hintText: 'Start to type',
        preventDuplicates: true,
        queryParam: 'name',
        noResultsText: 'No results',
        searchingText: 'Search',
        prePopulate: data
    });
}

All I want is to receive the parameter 'tipos[]' in my view, like this:

types = request.GET.getlist('tipos[]')

And receive this:

[u'almoxarifado', u'estoque']

But when i do this, he only gives me the last one and not all the list, in this case:

[u'estoque']

This is how I call the autocomplete function inside the js:

inicializa_busca('endereco', $("#id_enderecos"));
4

1 回答 1

0

You must be aware that, ajax is to pass small data, check the size of this list, maybe is better an full post submission!

于 2013-03-28T19:40:53.407 回答