I’m having a bit of trouble trying to post jQuery variables to a Rails cookie.
I want to store two jQuery variables when any user visits the page.
I’ve got a bit of Ajax making the post, thus:
/$.post('/where', {var1: one, var2: two});
I’m just not wholly sure how to set up the ‘/where’ part.
Any help would be great!
Cheers.
Instead of posting directly to a Rails cookie, you should post to the “/where” url, which calls a controller action. In the action, you can set the cookies.
For example,
in your routes, declare:
in your controller:
If that’s not what you’re looking for, can you elaborate more in your question?