Google Maps and returning compatible data

I am trying to add a google map to my application following the code
present on this page.

http://iheartmyyogi.com/map.html

here is the script I have, I made some changes for it to fit my needs…

In my table I have the following data

:Name, :ll_value, :id,

I am wondering how I can use ruby to return an array simillar to what
the original author is using in var sites?

I also tried returning json but the json returned is all html escaped so
i am not sure how i can use that in the javascript.

You can make a ajax json request via jquery(what I assume you are
using) by using $.getJSON(…).

If you want it to just load it in your views use:

var sites = <%= site_information.to_json %>

where site_information is a hash, or array.

You would be best, IMHO, using a hash and rewriting the JS to be a bit
more intelligent when adding the markers.

Just fyi, there is a gem to interact with google maps using Rails3:

Gmaps4rails

As it turned out, the problem I was having that the variable was
returning escaped json and resulting in resulting in errors.

Returning raw json did the trick.

Thanks for the help guys.

PsiPro wrote in post #999938:

You would be best, IMHO, using a hash and rewriting the JS to be a bit
more intelligent when adding the markers.

Unfortunately I am not that good in JavaScript so was trying to match
the input with what the script was using.

I have modified the controller as such

@sites = Array.new
$i = 0
for zone in @zones do
@sites[$i] = [zone.name, zone.lat, zone.lng, zone.id]
$i += 1
end

and in my view I am using to to_json method to get the proper json but I
have no idea how to modify the script so any help will be greatly
appreciated.