Google マップ ジオコーダーを使用して郵便番号をジオコーディングしています。郵便番号が存在する状態を返し、それを変数 "local" に格納する必要があります。local が未定義であることを示すエラーが表示されます。なんで?
以下のコードを参照してください。
var address=document.getElementById("address").value;
var radius=document.getElementById("radius").value;
var latitude=40;
var longitude=0;
var local;
geocoder.geocode( { 'address': address}, function(results, status){
if (status==google.maps.GeocoderStatus.OK){
latlng=(results[0].geometry.location);
latitude=latlng.lat();
longitude=latlng.lng();
//store the state abbreviation in the variable local
local=results[0].address_components.types.adminstrative_area_level_1;
}
else{
alert("Geocode was not successful for the following reason: " + status);
}
});