Ajax Autocomplete for Jquery : How To Send Dynamic Parameters
Alternatively, you can specify the params using a function which is evaluated just before the ajax request is sent.
$('#q').autocomplete({
...
params: {
'entity_type': function() {
return $('#top_search_select').val();
}
}
...
});
Might be an old question, but I feel that here's the best way to do it:
$('#q').autocomplete({
...
onSearchStart: function(q) {
q.entity_type = $('#top_search_select').val();
}
...
});