geo test
by aaronheld
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<input class="mainzip"/>
JavaScript
$(function() {
gmaps_url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=3"
$.getJSON(gmaps_url, function(result){
results_list = result['results'] || [] ;
$.each(results_list), function(i, v) {
if (results_list['address_components'] == undefined) return;
if ((v['types'] || []).indexOf('postal_code')) {
console.log(v['long_name']);
return;
}}
});
});