Using longitude and latitude after getting marked on Google Map

Developer Source

I'm trying to use the marked longitude and latitude which the user marks on the google map by pushing it into an array. Here's my code:

  var Drivers = [];
    google.maps.event.addListener(map, 'click', function(event) {
       placeMarker(event.latLng);
       var latLng = event.latLng;
       Drivers.push(latLng);
       //alert(event.latLng);
    });

Trying to log the array items and getting them nulls.

javascriptphpgoogle-maps

Answers

answered 6 months ago shary #1

To Get value of Latitude

latLng.lat()

To Get value of Longitude

latLng.lng()

comments powered by Disqus