Google maps -> sending coördinates

1 view
Skip to first unread message

Rails Surfer

unread,
Sep 3, 2010, 12:13:32 PM9/3/10
to rubyonra...@googlegroups.com
I need to send geo coördinates from a mysql database to a google maps
javascript.

There´s no problem to get them into rails...But how can i send them to
javascript ?

I know javascript is client side so i think it´s impossible to include
ruby variables...

Suggestions ?

Thanks
--
Posted via http://www.ruby-forum.com/.

Marnen Laibow-Koser

unread,
Sep 3, 2010, 12:20:31 PM9/3/10
to rubyonra...@googlegroups.com
Rails Surfer wrote:
> I need to send geo coördinates from a mysql database to a google maps
> javascript.
>
> There´s no problem to get them into rails...But how can i send them to
> javascript ?
>
> I know javascript is client side so i think it´s impossible to include
> ruby variables...
>
> Suggestions ?

What I always do is this: have Rails put the data in a hidden HTML
element with a known ID. Then the JavaScript can read the contents of
that element.

>
> Thanks

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Reply all
Reply to author
Forward
0 new messages