I have a marker on my map, it is "draggable", I would like to know how I can find the latitude and longitude of this marker, and later store it in the database.
I have read the documentation of google map api but have not found how to do this.
@Edit:
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 15,
center: franca
});
function CarregarEnderecoPorLatLng(latitude, longitude){
var latlong = [latitude, longitude];
var marker5 = new google.maps.Marker({
position: new google.maps.LatLng(latitude, longitude),
map: map
});
return latlong;
}
map.addListener('click', function (e) {
CarregarEnderecoPorLatLng(e.latLng.lat(), e.latLng.lng());
})
In this attempt to click it adds a marker, I thought of returning an array with latitude and longitude, but I'm confused as to how I'll get the latitude and longitude back through this function.