ruby on rails - How to get information from the currently clicked marker in gmaps4rails? -


I am trying to find a way to get information from the currently clicked marker on a map. For example, I want to show the title and description of the currently clicked marker to show on a different page. Any help is appreciated thanks.

You must add the listener to the click:

  var handler = Gmaps .build ('Google'); Handler .buildMap ({Provider: {}, Internal: {id: 'map'}}, function () {// I think you'll retrieve amrkers array var json_data = & lt;% = raw @ hash.to_json Are% & gt; marker = handler.edermakers (Jason_data); _Eich (Jason_data, function (jsone, index) {var marker = marker [index]; jsna marker = marker; google.maps.event.addListener ( Marker .getServiceObject (), 'Click', function () {console.log (json); // whatever you want here}};});});    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -