Hi,

I'm having trouble display JSON data from my Rails app to display on a
google map. As far as I can tell, the output to JSON seems fine:

[{"city_id":null,"country_id":
1,"created_at":"2010-06-02T21:00:17Z","description":"This is a
marker.","id":1,"lat":
44.797916,"lng":-93.278046,"name":"Hello","tag":"Hello","updated_at":"2010-06-02T21:00:17Z"}]

My map.js file contains the following:

$(document).ready(function(){
    if (GBrowserIsCompatible()) {
                var map = new google.maps.Map2($("#map").get(0));
        var burnsvilleMN = new GLatLng(44.797916,-93.278046);
        map.setCenter(burnsvilleMN, 8);
        map.setUIToDefault();

        $.getJSON("/places", function(json) {
            if (json.Places.length > 0) {
                for (i=0; i<json.Places.length; i++) {
                    var place = json.Places[i];
                    addLocation(place);
                }
            }
        });

        function addLocation(place) {
            var point = new GLatLng(place.lat, place.lng);
            var marker = new GMarker(point);
            map.addOverlay(marker);
        }
    }
});

$(window).unload( function () { GUnload(); } );

This code is adapted from this tutorial:
http://marcgrabanski.com/article/jquery-google-maps-tutorial-ajax-php-mysql
- the map appears, but with no markers (I'm using Safari). Any help
would be much appreciated - thanks in advance!

Sonia

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to