0

I'm using the gmap3 jQuery panel to load a map and putting a marker onto the map. I'd like to retrieve additional data when clicking on a marker. I have a side div called #panel and a div for the map, called #mappa. When the map is initialized, I add a marker with this code:

$('#mappa').gmap3({
    marker:{
        values:[{ latLng:[48.8620722, 2.352047], id:"1" }],
        events: {
            click: function() {
                $('#panel').load('ajax/test.html')
            }
        }
    }
}); 

This is working quite well, but now, being a jQuery newbie, have to ask some help. The id value of the marker is the id of a wordpress post that contains additional info about the marker's place. I'd like to call, via AJAX, the post with id=somenumber and load it into the panel. I don't understand how to reference to the marker id inside the function, though.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
razzetto
  • 13
  • 2

1 Answers1

0

Could you try this?

//get markers with id = value-of-id
markers = $('#mappa').gmap3({
        get:{
            name:"marker",
            id:function(id){
                return (id === value-of-id);
            }
        }
    });
$.each(markers, function(i, marker){
    // do something
}