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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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
This topic is locked and can not be replied to.