Inserting a rails link into a Google Maps infowindow
- by Sonia
Hi,
I would like to insert a link into the Google Maps InfoWindow to show more information about the point the user has clicked on in my rails app. My current code:
$.getJSON("/places", function(json) {
if (json.length > 0) {
for (i=0; i<json.length; i++) {
var place = json[i];
addLocation(place);
}
}
});
function addLocation(place) {
var point = new GLatLng(place.lat, place.lng);
var marker = new GMarker(point);
map.addOverlay(marker);
GEvent.addListener(marker, "click", function() {
var info = place.name + "<br>[link]";
map.openInfoWindowHtml(point, info);
});
}
I would like the link to take the user to the page for that marker (ie. /places/id), but am unsure of how to go about this...any help would be much appreciated!