autocomplete jquery post data

0

I need to send data from a form via post using the jquery autocomplete

link

so far I have the following method

$("#autocompletar").autocomplete(
          "<?php print base_url();?>Controller/Autocompletar/",
          {
                delay:10,
                minChars:1,
                matchSubset:1,
                matchContains:1,
                cacheLength:10,
                onItemSelect:selectItem,
                onFindValue:findValue,
                autoFill:false,
                formatItem:formatItem,
            }
     );

This sends the data of the autocomplete by get, I have a data of an input:

'dato': $('#id_dato').val(),

How can I send this data using the autocomplete and capture it in the backend I am using php 5

$this->input->post('dato');

Maybe some plugin function ... thanks.

    
asked by Javier Antonio Aguayo Aguilar 24.04.2017 в 20:57
source

1 answer

0

If I understood you correctly, this will help you. Add the function onSearchStart and generate all the parameters that you want to send to the query. In my case the input associated with the autocomplete is called " #buscar ".

onSearchStart: function () {
    $('#buscar').autocomplete('setOptions', {<b>params</b>: {'s-id': $("#serv-id").val(), 'search': $("#buscar").val()}, });
}

Tell me how it went. Greetings!

    
answered by 04.05.2017 в 15:15