Using Ruby on Rails 5.0.3 .
I want to set some value in cookie using JavaScript (when button clicked), and get it in Rails.
I know how to access session in Rails, which is session[:some_key] or cookies.
But I don't know how to do in JavaScript. (it must be able to accessed from Rails session or cookies.)
How can I do it in JS?
Or any other ways to save some value in JS, and get it later in Rails ?
XmlHttpRequest.cookies[:key]in Rails anddocument.cookieto get the cookie list in Client Side.