, , . , , Ruby , Javascript, . ; , :
alert('<%= session[:item_form_type]%>');
- :
alert('from_new_item_click');
If you really want to change your RoR code on the server side when the user takes an action, you need to use AJAX. Basically, AJAX allows your Javascript code to send GET / POST to a URL. So in your .click event handler, you can push the URL that triggers an action that changes any session variables you want.
(Sorry, if you already know everything about AJAX, I suspect you might not have asked your question.)
source
share