I'm new to Google Maps API. What I am trying to do with following code
is that I am fetching markers from server. And they have three
properties: lat, lng and id.
Now I want to display 'id' of marker I click in the bubble. How do I
do that?
I am storing marker.id in 'mid'. But that 'mid' cant be accessed in
the bubble.
Something to putt at ??? in GEvent.
Thanks a lot.
function listMarkers() {
var request = GXmlHttp.create();
request.open('GET', 'schools/list', true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var markers=eval( '(' + request.responseText + ')' );
var waqas = new Array(markers.length);
for (var i = 0 ; i < markers.length ; i++) {
var marker=markers[i].school
var lat=marker.lat;
var lng=marker.lng;
var mid = marker.id;
if (lat && lng) {
var m = new GLatLng(lat, lng);
m = new GMarker(m);
map.addOverlay(m);
GEvent.addListener(m, 'click',function()
{this.openInfoWindowHtml('hello from ' + ???]);});
}
}
}
}
request.send(null);
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---