Question

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?

Was it helpful?

Solution

place.photos is an Array , you must select an item of the array to get details for a particular photo

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top