devbridge / jQuery-Autocomplete

Ajax Autocomplete for jQuery allows you to easily create autocomplete/autosuggest boxes for text input fields
https://www.devbridge.com/sourcery/components/jquery-autocomplete/
Other
3.57k stars 1.67k forks source link

append a value to the end of the query #825

Closed strukturart closed 3 years ago

strukturart commented 3 years ago

Hello,

I try to add a value at the end of the query, it works like this:

  onSearchStart: function() {
            var input = $(this),
            instance = input.data('autocomplete');
            instance.options.params = ""
            instance.options.params = url + "&address=" + input.val() + ", helloWorld";
        }

but if the user changes the values i get the following message: jquery.autocomplete.min.js:549 Uncaught TypeError: Cannot create property 'address' on string

how can I run the search again ?

strukturart commented 3 years ago

I found a solution!

 ajaxSettings: {
            beforeSend: function(jqXHR, settings) {

                settings.url += "helloWorld";
            }
        },

thanks for reading.