title: Postal code google map return
body: <p>I've been trying to figure this out for so long that I'm sure it's staring me in the face.</p>
  
  <p>I'm using jquery to auto complete an address being entered by a user with the following code: </p>
  
  <pre><code>    $(function() {
        $("#address").autocomplete({
        //This bit uses the geocoder to fetch address values
        source : function(request, response) {
        geocoder.geocode({'address' : request.term },
  
  function(results, status) {
     response($.map(results, function(item) {
     return {
        label : item.formatted_address,
        value : item.formatted_address,
        latitude : item.geometry.location.lat(),
        longitude : item.geometry.location.lng(),
        streetNo : item.address_components[0].long_name,
        streetName : item.address_components[1].long_name,
        town : item.address_components[2].long_name,
        province : item.address_components[4].long_name,
               }
           }));
        })
    }
  </code></pre>
  
  <p>I need to extract the address components specfically i.e. postal code. Right now I'm using numbers but depending on the address inputted, the fields may or may not be correct.</p>
  
  <p>I pretty much have the same question this guy did: </p>
  
  <p><a href="https://stackoverflow.com/questions/8380511/google-maps-geocoder-return-postal-code">Google Maps Geocoder: Return postal_code</a></p>
  
  <p>The answer to that question is appropriate but the issue I"m having his when I try to loop, or do <em>anything</em> other than extract the info the way it's already done here the script fails.</p>
  
  <p>Based on the way the jquery autocomplete does it's google query, can I assign the "results" to a variable and then parse it that way for correct type names? </p>
  
  <p>Everything I've tried so far has failed, usually resulting in the script not running.</p>
  
  <p>I'm getting desperate here, hopefully my question is coherent! :P</p>