title: How do I add a user-input marker to Google Maps widget on my website, and get the latitude and longitude data from it?
body: <p>How do I add a user-input marker to Google Maps widget on my website, and get the latitude and longitude data from it?</p>
  
  <p>Right now I am building an application which has to allow users to drop a marker to any location so that I can get that data and process it.</p>
  
  <pre><code>   &lt;script&gt;
                  var map;
                  function initMap() {
                    map = new google.maps.Map(document.getElementById('map'), {
                      zoom: 2,
                      center: new google.maps.LatLng(2.8,-187.3),
                      mapTypeId: 'terrain'
                    });
  
                    // Create a &lt;script&gt; tag and set the USGS URL as the source.
                    var script = document.createElement('script');
                    // This example uses a local copy of the GeoJSON stored at
                    // http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.geojsonp
                    script.src = 'https://developers.google.com/maps/documentation/javascript/examples/json/earthquake_GeoJSONP.js';
                    document.getElementsByTagName('head')[0].appendChild(script);
                  }
  
                  // Loop through the results array and place a marker for each
                  // set of coordinates.
                  window.eqfeed_callback = function(results) {
                    for (var i = 0; i &lt; results.features.length; i++) {
                      var coords = results.features[i].geometry.coordinates;
                      var latLng = new google.maps.LatLng(coords[1],coords[0]);
                      var marker = new google.maps.Marker({
                        position: latLng,
                        map: map
                      });
                    }
                  }
                &lt;/script&gt;
  </code></pre>
  
  <p>Right now I am using this, but this doesn't offer any user submitted markers.</p>