title: Extract coordinates of google map point to google sheets in HTML
body: <p><em>First question</em> So i'm getting started with HTML/JS and i'm having trouble extracting the coordinates of a marker placed by the user and putting them into a spreadsheet.
  As it stands, there are two parts of the HTML document. One is a map with a point and displays the lat/long and other info. The other part is a form which asks the user to input lat/long coords and a description. This gets submitted automatically into a Google Questionaire and then into a Google Sheets. </p>
  
  <p>What I want to do is submit the coordinates of the point on the map instead of having the user do it on their own.</p>
  
  <pre><code>    function postContactToGoogle() {
          var latitude=document.getElementById('pointLat');
          var longitude=document.getElementById('pointLng');
          var description=$('#description').val();
  
  
               $.ajax({
               url:"https://docs.google.com/forms/d/e/1FAIpQLSccwx1JnSaptL1JlXy-Jmr2S9NjkisKRsmj0pt_4E6bATYVdA/formResponse",data:{"entry.149945546":latitude,"entry.760486044":longitude,"entry.573971734":description},type:"POST",dataType:"xml",statusCode: {0:function() { window.location.replace("CoordsfromPoint.html");},200:function(){window.location.replace("CoordsfromPoint.html");}}
               });
               }
  </code></pre>
  
  <p>In the HTML, the script looks like this:</p>
  
  <pre><code>     &lt;b&gt;Latitude&lt;/b&gt;
       &lt;div id="pointLat"&gt;&lt;/div&gt;
       &lt;b&gt;Longitude&lt;/b&gt;
       &lt;div id="pointLng"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And the values are given by the JS functions:</p>
  
  <pre><code>    function getPoint_Lat(latLng) {
        document.getElementById('pointLat').innerHTML = [
          latLng.lat()
        ];
  
       }
  
       function getPoint_Lng(latLng) {
        document.getElementById('pointLng').innerHTML = [
          latLng.lng()
        ];
        longitude = [latLng.lng()];
       }
  </code></pre>
  
  <p>When run as a website, the above 2 functions work to show the current lat and long of the marker in a map. But when I try to export those coordinates to the google sheet it shows up blank. What's going on?</p>
  
  <p>Full code:</p>
  
  <p><a href="http://codepen.io/kwilly/pen/RpWvGW/" rel="nofollow noreferrer">http://codepen.io/kwilly/pen/RpWvGW/</a></p>