Rails: passing value: view to controller to view with Javascript/Ajax
===

In one of my forms, I have an element called event_id which value I select from a dropdown box. Once I select event_id, I want to use Ajax to call the controller, and return panel_event_id as a ruby variable that I can use in the rest of the form. Here's what I'm doing:

In routes.rb, I have the following:

match 'panel_event_id', :to => "panels#event_id"

I have the following javascript function (not sure about the syntax):

    <script type="text/javascript">
      $('select').change(set_session_event_id);

      function set_session_event_id()
      {
        var event_id = document.getElementById("event_id");
        var event_id_value = event_id.value;
        $.post('panel_event_id', { set_event_id: event_id_value });
      }
    </script>

What do I put in my panel_controler.rb, in the following method:

    def panel_event_id
    end

and how do I act on it back in my view?