title: Why can't the console define id?
body: <p>I'm trying to get the console to show the id as well as the latitude and longitude this is to ideally save it in an array which i can then store onto a mysql database. This involves the use of the google maps Javascript API. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;script&gt;
   var markers;
          function initMap() {    
          var geocoder = new google.maps.Geocoder();
          var map = new google.maps.Map(document.getElementById('map'), {
            zoom: 12
          });
          var infoWindow = new google.maps.InfoWindow;
  
            // Change this depending on the name of your PHP or XML file
              // this connects to the database
               function geocodeAddress(geocoder, resultsMap) {       
            downloadUrl('maps.php', function(data) {
        //        var cdata = JSON.parse(document.getElementById('data').innerHTML);
              var xml = data.responseXML;
              var markers = xml.documentElement.getElementsByTagName('marker');
              Array.prototype.forEach.call(markers, function(markerElem) {
                var id = markerElem.getAttribute('id');
                var name = markerElem.getAttribute('name');
                var address = markerElem.getAttribute('address');
                var type = markerElem.getAttribute('type');
                var lat = markerElem.getAttribute('lat');
                var lng = markerElem.getAttribute('lng');
                var infowincontent = document.createElement('div');
                var strong = document.createElement('strong');
                strong.textContent = name
                infowincontent.appendChild(strong);
                infowincontent.appendChild(document.createElement('br'));
                var text = document.createElement('text');
                text.textContent = address
                infowincontent.appendChild(text);
              geocoder.geocode({'address': address}, function(results, status) {
            if (status === 'OK') {     
              resultsMap.setCenter(results[0].geometry.location); 
              lat = (results[0].geometry.location.lat());
              lng = (results[0].geometry.location.lng());
                var points = {};
                points.id = id.id;
                points.lat = map.getCenter().lat();
                points.lng = map.getCenter().lng();
                getlatlng(points);
              var marker = new google.maps.Marker({
                map: resultsMap,
                position: results[0].geometry.location
              });
            } else {
              alert('Geocode was not successful for the following reason: ' + status);
            }
                               marker.addListener('click', function() {
                  infoWindow.setContent(infowincontent);
                  infoWindow.open(map, marker);
                });
          })   
  
              });   
            });
             function getlatlng(points) {
                 console.log(points);
             }
               }
  geocodeAddress(geocoder, map);
  
        function downloadUrl(url, callback) {
          var request = window.ActiveXObject ?
              new ActiveXObject('Microsoft.XMLHTTP') :
              new XMLHttpRequest;
  
          request.onreadystatechange = function() {
            if (request.readyState == 4) {
              request.onreadystatechange = doNothing;
              callback(request, request.status);
            }
          };
  
          request.open('GET', url, true);
          request.send(null);
  
        }
          }
  
        function doNothing() {}
  
      &lt;/script&gt; 
  </code></pre>
  
  <p>When the console is loaded, the <code>id</code> will show up as undefined while the <code>lat</code> and <code>lng</code> will be displayed. Can someone please help me with this issue?</p>