In my nav-list, I have a drop box selection that contains all users, exclusively available to an administrator. The administrator can select a user, and the view is updated via ajax to display the selected user's information.
The view is updated with something like this:
$(#Users).change(function() {
$ajax({
... yada yada update information in view.
However, what I want to implement is if I change to another view/url (Such as my account html.erb to a mygraph.html.erb) or refresh my page, I want the user drop box selection to persist with the user selection I made.
I thought of using rails cookies to do this. But I must redirect to controller to set the cookie.
I attempted a POST ajax call,
$(#Users).change(function() {
$.ajax({
...
data: {
"<%= cookies[:selected] %>": this.value
It doesn't work, but for some reason, I already doubted that it would be that simple.
How should I implement this solution?