Tuesday, 15 March 2011

ruby on rails - Open & populate infowindow via ajax on "click" with Gmaps4Rails -


When I click the map marker, I populate a Google map infowindow with partial content (via AJAX) I am trying to do / P>

EpineEdivings Wiki Post has helped here:

I have a model for example an ID that I want to get in the marker (from source: "marker.json ({: id => User.id}) "). But I do not know how to use the markers to add the listener to click it, and then put the resulting HTML in the infowindow.

After you create your markers:

  marker = handler . Ed Markers (...); _.each (marker, function (marker) {google.maps.event.addListener (marker.getServiceObject), 'click', function () {$ .get (expectedUrl) .done (function (data) {// only you Know how `data` is structured var infowindow = new google.maps.InfoWindow ({content: 'content'}) infowindow.open (handler.mitemap), marker.getServiceObject ());})})}} );  

No comments:

Post a Comment