编辑:问题解决了我正在尝试使用这样的变量分配类型
check = [];
if($("#transport").attr("checked"))
check.push('airport','bus_station','train_station','taxi_stand','travel_agency');
if($("#bars").attr("checked"))
check.push('bar','restaurant');
if($("#tourist").attr("checked"))
check.push('art_gallery','campground','museum','aquarium','zoo','library','amusement_park','park');
if($("#shopping").attr("checked"))
check.push('shopping_mall','shoe_store','jewelry_store','grocery_or_supermarket','furniture_store','electronics_store','clothing_store','book_store');
var tmp_types = "";
for(i=0;i<1;i++)
{
tmp_types += '"'+check[i]+'"';
}
var request = {
location: latlng,
radius: '50000',
types: [ tmp_types ]
};
service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);
但它不起作用...有人可以帮助我...谢谢
解决方案:只需使用 check 代替 tmp_types 并删除方括号..像这样的类型:检查.. 感谢 Bruno