Есть функция:
function getState(zipcode) {
var state = "N/A";
state = geocoder.geocode( { 'address': zipcode}, function (result, status) {
if (status == google.maps.GeocoderStatus.OK) {
state = result[0]['address_components'][component]['short_name'];
[B]return state;[/B]
}
});
}
Тут он, как я понимаю, возвращает в подфункцию
function (result, status) {}
Как мне вернуть state в главной функции?
Так не работает
function getState(zipcode) {
var state = "N/A";
state = geocoder.geocode( { 'address': zipcode}, function (result, status) {
if (status == google.maps.GeocoderStatus.OK) {
state = result[0]['address_components'][component]['short_name'];
}
});
[B]return state;[/B]
}