JS variable -> ruby?

I have a little javascipt script to determine a users GMT timezone
offset… is it possible to use that variable in ruby code, in the view?

js script:

Thanks!
-stirman

Jason S. wrote:

I have a little javascipt script to determine a users GMT timezone
offset… is it possible to use that variable in ruby code, in the view?

js script:

Thanks!
-stirman

Not directly, in as much as the ruby is executed on the server when the
page is served, and the JS is executed on the client. You can sort of
merge the two by doing RJS, which is ruby code that generates
javascript. ie the Ruby is ultimately executed on the client instead of
the server.

A,

Jason S. wrote:

I have a little javascipt script to determine a users GMT timezone
offset… is it possible to use that variable in ruby code, in the view?

js script:

Thanks!
-stirman

Javascript is only executed after the render is finished. So the only
way is to post an Ajax request with the content you want back to the
server, like on page load or something.

Got it, thanks!

Javascript is only executed after the render is finished. So the only
way is to post an Ajax request with the content you want back to the
server, like on page load or something.