codeAddress 함수의 latlon 변수를 반환하는 방법은 무엇입니까? 아마도 범위 때문에 반환 latlon가 작동하지 않지만 어떻게 작동하게하는지 확신 할 수 없습니다.동일한 함수의 메소드 콜백 데이터에서 함수의 변수를 반환하십시오.
function codeAddress(addr) {
if (geocoder) {
geocoder.geocode({ 'address': addr}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latlon = results[0].geometry.location.c+","+results[0].geometry.location.b;
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}
감사합니다. 저는 jquery ajax 콜백에서 여러 번이 문제에 대처하여 오늘 생각하지 않았습니다. 두뇌 부양에 감사드립니다. – aran