Skip to content

request extra params

mmx edited this page Jan 2, 2019 · 1 revision

Pass extra params to the server

By default, the request to server has one param 'q'.

/autocomplete_path?&q=<<your_string>>

In order to pass more params to the server, use option 'data-func-params' for autocomplete input:

<input ... data-func-params="my_autocomplete_get_params">

Specify your custom javascript function. The function will be executed before sending params to the server.

<script>
function my_autocomplete_get_params(){
    // define your extra params here
        
    return {p1: "value1", p2: "value2"};
}

</script>

The request to the server will be

/autocomplete_path?&q=<<your_string>>&p1=value1&p2=value2

Clone this wiki locally