Friday, August 10, 2012

[Rails] Set session on jQuery.load function

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

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate