views:

13

answers:

1

hi

i have assigned session value in jquery, as

$.session("example","mysession");

and when is retrive it in html.erb page, i am not getting session value..

please, give me solution for this.. how to retrive jquery session value in erb file

thanks

+2  A: 

You need to understand the sequence of what is happening. All of the jquery stuff happens AFTER the page is built by rails (on the server), sent over the internet to the browser, then displayed in the browser. The only way jquery (or the browser in general) can communicate with rails is via an http request back to the server, eg when you submit a form. So, you could put a value in a hidden field in a form for example.

However, it's possible that that's not even necessary. If you explain your broader problem then maybe someone can suggest a solution that doesn't require jquery to send values back to rails in a seperate request.

Max Williams