2

I'm beginer to js and api

I have an for me big problem..

How to get photo for some places with google places api.

I try with this:

function setLink(i) {
            var photo = place.photos;
            var sideClick = jQuery("<a class=side_click href='#'></a>");
             $(sideClick).html(place.name+photo);
             $("#side_bar").append(sideClick).append("<br>");
             $(sideClick).on("click", function() {
               markers[i].modalWindow_.getDetails(markers[i].place_);
             });
          }

and I get only something like this:

Hotel Name [object Object]

How to change this [object Object] into url of image?

also i try with:

var photo = place.photos.geturl(); 

but also dont work...

How to solve this problem?

4

1 回答 1

3

place.photos是一个 Array ,您必须选择数组中的一项才能获取特定照片的详细信息

https://developers.google.com/maps/documentation/javascript/places#places_photos

于 2013-06-30T13:38:25.833 回答