Forum: Ruby on Rails Set session on jQuery.load function

3bc7b6532e1537ca139c02f091636d3b?d=identicon&s=25 Aashish Kiran (aashishkiran)
on 2012-08-10 10:03
Hi,
I have a strange problem.
Scenario:
When loading an x page. I am making an ajax call in jQuery to server
'latest' action. Now, when I set a session in 'latest' action. To check
check created session I made another ajax request to same 'latest'
action.

Here created session is nil.
code:
--------------------------sample.js------------------------------
 $("#latest_activities").load("#{latest_activities_path}");

 $('.get-activities').click(function(){
         //ajax request to latest_activities_path
      });

 def latest
  p  session['test']
  session['test'] = 'test'
 end

I did got why it is not persisted.

Thanks,
Aashish
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.