AJAX to change session data

Hi, I am trying to figure out how to implement AJAX to set a session variable when a user selects from a dropdown. I have not used AJAX before.

My dropdown code is: <%= collection_select(           :question,            :subject_id,            Subject.order(:title),            :id,            :title,            :prompt => "Select a Subject") %>

My coffeescript is jQuery ->   books = $('#question_book_id').html()   $('#question_subject_id').change ->     alert("Set the session[subject] now!")     subject = $('#question_subject_id :selected').text()     escaped_subject = subject.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1')     options = $(books).filter("optgroup[label='#{escaped_subject}']").html()

I assume I create a method in users_controller to change the session variable. My question is how do I call it in the jquery code?

This seems to work...

Routes: match '/users/update_subject', :to => 'users#update_subject', :as => :update_subject

jQuery:         ...   $.ajax(          url: '/users/update_subject',          data: "subject_title=" + subject)

Controller: def update_subject     session[:subject] = params[:subject_title] end

Can anyone tell me if it is OK to use a GET request (default) for this or do I need to specify a POST, as I am only using this to set a session variable and not hitting the database?

Thanks!