# Ruby variable = javascript variable?

**URL:** <https://www.ruby-forum.com/t/ruby-variable-javascript-variable/167983>\
**Category:** Rails\
**Created:** [May 14, 2009, 5:02pm UTC](https://www.ruby-forum.com/t/ruby-variable-javascript-variable/167983 "2009-05-14T17:02:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![semi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@semi](https://www.ruby-forum.com/u/semi)\
**Post date:** [May 14, 2009, 5:02pm UTC](https://www.ruby-forum.com/t/ruby-variable-javascript-variable/167983/1 "2009-05-14T17:02:27Z")

</div>

Is there a way to store the value of a js variable in a ruby variable?  
The reason I ask is because, for example, when a google maps api  
returns the result of let’s say the location on the map, it returns it  
in a js variable. I need to get the value from that variable to be  
stored in a ruby variable. Is there a way in which I can do that?  
Thanks.

---

<div class="post-metadata">

**Author:** ![semi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@semi](https://www.ruby-forum.com/u/semi)\
**Post date:** [May 14, 2009, 5:35pm UTC](https://www.ruby-forum.com/t/ruby-variable-javascript-variable/167983/2 "2009-05-14T17:35:20Z")

</div>

On May 14, 4:01 pm, semi [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there a way to store the value of a js variable in a ruby variable?  
> The reason I ask is because, for example, when a google maps api  
> returns the result of let’s say the location on the map, it returns it  
> in a js variable. I need to get the value from that variable to be  
> stored in a ruby variable. Is there a way in which I can do that?

make an http request to your app (either an ajax request or a more  
traditional form submission)

Fred

---

<div class="post-metadata">

**Author:** ![semi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@semi](https://www.ruby-forum.com/u/semi)\
**Post date:** [May 14, 2009, 10:48pm UTC](https://www.ruby-forum.com/t/ruby-variable-javascript-variable/167983/3 "2009-05-14T22:48:41Z")

</div>

On May 14, 11:33 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> make an http request to your app (either an ajax request or a more  
> traditional form submission)
> 
> Fred

Thanks for the idea. I did something like this, but the page keeps  
reloading over and over:

\<%= params[:keyword] %\>
