Infobulle pour marqueur dans gmap

Fermé
Victoire - 30 mars 2011 à 13:07
Bonjour,
je suis entrain de développer une application qui permet d'afficher la position géographique des utilisateurs enregistré dans un site. et je veux récupérer leurs coordonées une fois cliqué sur le marqueurs indiquant leur position.

voici le code de ma page d'affichage:

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html {
height: 100%
}
body {
height: 100%;
margin: 0px;
padding: 0px
}
#map_canvas {
height: 500px;
width:500px;
}


</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=true">
</script>
<script type="text/javascript">
var latlng = "";
var map = "";
var savedMarkers = new Array();
var newMarkers = new Array(); // tableau de markeur

// fonction initialize qui permet d'integrer google maps dans la page
function initialize() {
latlng = new google.maps.LatLng(35.728677, 9.42627);
var myOptions = {
zoom: 7,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP

};


map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);


$.ajax({
type: 'get',
url: 'lister.php',
dataType: 'json',
success: function (json) {
afficher(json,map);
}
});
}
// fonction qui permet d'afficher un marker

function afficher(markers,map){
$.each(markers.markers, function(index, marker) {
// une fonction à exécuter pour chaque élément correspondant
addmarkerToMap(new google.maps.LatLng(marker.lat, marker.lang),map,savedMarkers,false);
});


};

function addmarkerToMap(position,map,markers,draggable){
var marker = new google.maps.Marker({
position: position,
map: map,
animation: google.maps.Animation.DROP,
draggable: draggable // marqueur deplacable

});
markers.push(marker);

}

</script>
</head>
<body onLoad="initialize()">
<div id="map_canvas" ></div>
<div id="map_canvas_controls" style="height:20px;width:100%"></div>

</body>
</html>

Merci de pouvoir m'aider, je serai reconnaissante.