I have assigned session value in jQuery, as
$.session("example","mysession");
And when it is retrieved in html.erb page, I am not getting session value..
Please, give me solution for this. How to retrieve jQuery session value in erb file?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.