google javascript place库-附近搜索&;getDetails结果don';t返回照片对象

google javascript place库-附近搜索&;getDetails结果don';t返回照片对象,javascript,google-places-api,google-places,Javascript,Google Places Api,Google Places,我尝试使用java脚本获取lat/lng的本地图像。我也尝试了Google place java脚本API。结果发现autocomplete.getPlace()返回结果中的photos对象,但service.nearbySearch或service.getDetails不返回相同的结果。 像 但下面的代码不会在结果中返回photos对象 service.nearbySearch(request, callback); function callback(results.status){

我尝试使用java脚本获取lat/lng的本地图像。我也尝试了Google place java脚本API。结果发现autocomplete.getPlace()返回结果中的photos对象,但service.nearbySearch或service.getDetails不返回相同的结果。 像

但下面的代码不会在结果中返回photos对象

service.nearbySearch(request, callback);

function callback(results.status){
    if (status === google.maps.places.PlacesServiceStatus.OK) {     
        var place=results[0];
        console.log(place.photos);/* undefined don't return photos */
    }
}

有人能帮我理解这是一个bug还是我的代码有任何问题吗


这是我的链接,我看到您只传递结果状态,而不是完整结果。试试这个

service.nearbySearch(request, callback);

function callback(results){
    if (results.status === google.maps.places.PlacesServiceStatus.OK) {     
        var place=results[0];           
    }
}
如果这不起作用,您可能需要调用该位置的getDetail服务,例如

function callback(results){
        if (results.status === google.maps.places.PlacesServiceStatus.OK) {     
            var place=results[0];  
            service.getDetails(place, callback2);
        }
    }

当然,您还需要一个callback2函数。但是现在测试第一部分,不确定第二部分是否有必要(我已经做了一段时间了)

很抱歉输入错误。请阅读callback(results,status)而不是callback(results.status)。感谢您的回复。
service.nearbySearch(request, callback);

function callback(results){
    if (results.status === google.maps.places.PlacesServiceStatus.OK) {     
        var place=results[0];           
    }
}
function callback(results){
        if (results.status === google.maps.places.PlacesServiceStatus.OK) {     
            var place=results[0];  
            service.getDetails(place, callback2);
        }
    }