ので、私は持っています
function find_coord(lat, lng) {
var smart_loc;
var latlng = new google.maps.LatLng(lat, lng);
geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'latLng': latlng }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
smart_loc = new smart_loc_obj(results);
} else {
smart_loc = null;
}
});
return smart_loc;
}
smart_loc変数/オブジェクトを返したいのですが、関数のスコープ(results、status)がfind_coord関数で宣言されたsmart_locに到達しないため、常にnullになります。では、関数内の変数(結果、ステータス)をどのように取得しますか?