title: Javascript google map api function that i need help understanding
body: <p>I do mostly back-end work and know very little javascript (emphasis on the word little). I came across some javascript code embedded within the html page of a website. Now i am not sure what's happening here.</p>
  
  <p>What i understand is, it's a javascript google map api function of some sort(maybe i am wrong). What i need to understand is what it's doing.</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api    
      /js?key=*********************&amp;libraries=places"&gt;
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      google.maps.event.addDomListener(window, 'load', function () {
          var places = new google.maps.places.Autocomplete(document.getElementById('txtPlaces'));
          google.maps.event.addListener(places, 'place_changed', function () {                                                                                                
              var place = places.getPlace();
              var address = place.formatted_address;
              var latitude = place.geometry.location.lat();
              var longitude = place.geometry.location.lng();
              var mesg = "Address: " + address;
             /* mesg += "\nLatitude: " + latitude;
              mesg += "\nLongitude: " + longitude;
              alert(mesg);*/
      document.getElementById('locc').value =   address;
          document.getElementById('latttt').value = latitude;
         document.getElementById('lonnnn').value = longitude;
          });
      });
  &lt;/script&gt;
  &lt;input type="hidden" name="loc" id="locc" value=""&gt;
  &lt;input type="hidden" name="latitu" id="latttt" value=""&gt;
  &lt;input type="hidden" name="longitu" id="lonnnn" value=""&gt;
  </code></pre>