I have several tokens retrieved from mySQL database with php, generating the following code for each token:
var marker28= new google.maps.Marker({position:new google.maps.LatLng(64.2,11.4),map: map,draggable: true,icon: 'slayer.png',title: '#28 slayer (64.2, 11.4)'}); google.maps.event.addListener(marker28, 'dragend', markerMoved(marker28)); var marker25
.... etc.
Then I have the following function:
function markerMoved(movedMarker){ movedMarker.title = movedMarker.position; }
I have the following 2 problems:
1) the dragend fire event without dragging, when the markers are first created, doesnβt really matter much, but ...
2) the new position is not updated, the title is set to the first starting position no matter where I drag the handles. I tried the getPosition () method with the same result.
The idea is to write new positions back to the mySql database from this function via a (async) GET request to the track.php file
source share