I'm using version 1.8.13 of jQuery UI's Auto complete and by default jQuery is using the query parameter of "?term=" by default, while my app is using "?q=" in the string it is creating. I COULD change the variable to be "term" on the backend, but I'd rather just tell jQuery what the server is trying to send it. Is there a way to change this?
Right now I just have something like this and it works if I change the variable to "term" on the backend, but like I said I wanted to change it to "q" and I can't find any info online about setting the parameter (that works):
$( "#input-search").autocomplete({
source: "/search/autocomplete/"
});
In that case, you need to define a callback function to the source option of autoComplete call. Also, you can pass multiple parameters using this approach. Your jQuery UI Autocomplete function would be like the following. In the source file, you can get the term and additional parameters using the $_GET variable.
In the process of searching a specific value, the jQuery UI autocomplete selection feature provides the user with some string suggestions for the input area which effectively saves time. The autocomplete select action is triggered when the user selects one of the options from the pre-populated list.
Syntax: $("TagId"). autocomplete({ source : itemList // List of Words. })
Autocomplete, or word completion, is a feature in which an application predicts the rest of a word a user is typing. In Android and iOS smartphones, this is called predictive text. In graphical user interfaces, users can typically press the tab key to accept a suggestion or the down arrow key to accept one of several.
You could use the callback form of source
and handle all the interaction with the server yourself. Something like this:
$("#input-search").autocomplete({
source: function(request, response) {
$.get('/search/autocomplete', { q: request.term }, function(data) {
response(data.split('\n'));
});
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With