Passing parameter from one autocomplete-jquery to another

Rails 3.1.3

My app has two consecutive rails3-autocomplete-jquery form_tags

I want to pass a parameter, which depends on the first
autocomplete_field_tag choice, to the second. The second form should
search based on the parameter.

<%= autocomplete_field_tag :departure_id, ‘’,
autocomplete_city_name_plans_path, :size => 75,
‘data-delimiter’ => ’ ’ %>

<%= autocomplete_field_tag :destination_id, ‘’,
autocomplete_destination_name_plans_path,
:size => 75, ‘data-delimiter’ => ’ ’ %>

They are defined in routes.rb

    resources :plans do
        get :autocomplete_city_name, :on => :collection
        get :autocomplete_destination_name, :on => :collection
    end

I tried using jquery

$('#departure_id').bind('railsAutocomplete.select', function(event,

data){
departure = data.item.id;
if(departure == “”) departure=“0”;
jQuery.get(‘/plans/update_destination_select/’ + departure,
function(data2){

});

can pass a value to an action in plans_controller.rb

def update_destination_select
    departure = City.find_by_id(params[:id]) unless

params[:id].blank?
@temp_departure_id = departure.id

end

But the class variable @temp_departure_id does not work.

Is there anyway to pass a value from the first autocomplete-jquery to
another?

soichi