私は次のJavaScriptを持っています:
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
place = new Object ({
name: results[i].name,
photo: results[i].photos[0].getUrl({'maxWidth': 100, 'maxHeight': 100}),
loc: results[i].geometry.location,
rating: results[i].rating,
})
places.push(place);
var marker = new google.maps.Marker({
map: map,
position: results[i].geometry.location,
id: i,
visible: false,
});
markers.push(marker);
}
}
newresult();
}
次の行をコメントアウトすると、関数 newresult() が実行されます。
photo: results[i].photos[0].getUrl({'maxWidth': 100, 'maxHeight': 100}),
ただし、上記のコードのように、コメントアウトしないと関数 newresult() は実行されません。有効な URL を返すので、photo の getUrl 関数が機能することはわかっています。
助けてくれてありがとう。