tags:

views:

17

answers:

1

hi fellows , http://code.google.com/intl/tr-TR/apis/maps/articles/phpsqlajax.html#createmap im using the tutorial linked above in tutorial they explain how to add markers with php &mysql

but i need to get latitude and longtitude by moving markers?? im a javascript beginner. how can i do it easily?

+1  A: 

All you need are the .getPosition() method of the marker and the .addListener method of google.maps.event. So all you need to do is listen for the dragend event of the marker and then pull out the LatLong location of the event. That will give you the new LatLong of the marker, which you can then send back to your PHP script if desired.

Sean Vieira
im trying to find out how that getPosition() function works i added it into dragend event but it is returning me any latlong value.
Ahmet Yıldırım
var map = new GMap2(document.getElementById("map")); var point = new GLatLng(51.49, -0.12); var marker = new GMarker(point, { draggable: true }); map.setCenter(point, 8); map.addOverlay(marker); function toggleDrag() { if (marker.draggingEnabled()) { marker.disableDragging(); } else { marker.enableDragging(); } } GEvent.addListener(marker, 'dragend',function(event) { GMarkerManager.refresh(); document.form.box.value=marker.getPosition(); }); this is the script i useit stucksafter drag
Ahmet Yıldırım
Ahmet Yıldırım