Topic: Sending additional params to Ajax.Autocompleter

var start_station_name_auto_completer = new Ajax.Autocompleter('thing_name', 'thing_name_auto_complete', '/search/auto_complete_for_thing_name', {paramName: "search", minChars: 2})

This is my code and it works fine, however I would like to further filter the results of the autocomplete based on another text field. Is there a way to send additional params as well as the content of the input...?

Many thanks, K.

Re: Sending additional params to Ajax.Autocompleter

Just add 'params' to your options:

change
{paramName: "search", minChars: 2}
to
{paramName: "search", minChars: 2, params: 'var1=a&var2=b'}

Re: Sending additional params to Ajax.Autocompleter

Thanks Danger,

I have added your changes but var1 and var2 do not get sent as part of the ajax request, Im using Firebug plugin to Firefox to look at the ajax requests being sent.


Many thanks in advance, AFM.

Last edited by afm (2006-09-19 05:14:07)

Re: Sending additional params to Ajax.Autocompleter

Okay its parameter instead of params smile

var start_station_name_auto_completer = new Ajax.Autocompleter('start_station_name', 'start_station_name_auto_complete', '/search/auto_complete_for_station_name', {paramName: "search", minChars: 2, parameters: 'var1=a&var2=b'})

This link http://wiki.script.aculo.us/scriptaculo … ocompleter helped make the parameters dynamic.

Last edited by afm (2006-09-19 06:23:19)

Re: Sending additional params to Ajax.Autocompleter

Whoops, my bad.  Way to go :-)