【发布时间】:2019-12-10 23:26:54
【问题描述】:
我正在寻找一种避免被收费的方法
- Places API 大气数据
- Places API 联系数据
我只需要将地点 ID 反转为其formatted_address。知道我需要在下面的代码中进行哪些更改吗?
Related question,虽然我用的不是Autocomplete而是PlacesService。
$('.company_location_id').each(function(i, obj) {
if ($(this).length > 0) {
if ($(this).val()) {
var request = {
placeId: $(this).val()
};
service = new google.maps.places.PlacesService(document.getElementsByClassName($(this).attr('class'))[0]);
service.getDetails(request, callback);
var new_text = $(this)
function callback(place, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
$(new_text).next().text(place.formatted_address);
}
}
}
}
});
【问题讨论】:
标签: javascript google-maps google-places-api