Monday 15 September 2014

javascript - Remove commas between google places types -


I have tried to use the Google Places API. I have received these codes.

  var map, list of locations; Function initialize () {var pyrmont = new google.maps.LatLng (-33.8665433, 151.1956316); Map = new google.maps.Map (document.getElementById ('map-canvas'), {mapTypeId: google.maps.MapTypeId.ROADMAP, center: peremot, zoom: 17}); Var Request = {Location: Peermot, Radius: 500, Type: ['Store']}; PlacesList = document.getElementById ('places'); Var service = new google.maps.places.PlacesService (map); Service. Search (request, callback); } Function callback (result, status, pagination) {if (status! = Google.maps.places.PlacesServiceStatus.OK) {return; } Other {build marker (result); If (pagination.hasNextPage) {var moreButton = document.getElementById ('more'); MoreButton.disabled = false; Google.maps.event.addDomListenerOnce (more button, 'click', function () {moreButton.disabled = true; pagination.NXTPP ();}); }}} Create the scripts (space) {var bounds = new google.maps.LatLngBounds (); (Var i = 0, location; location = location [i]; i ++) {var image = {url: place.icon, size: new google.maps.size (71, 71), originally: new google.maps Point (0, 0), anchor: new google.maps.Point (17, 34), scale size: new google.maps.size (25, 25)}; Var marker = New google.maps.Marker ({Map: Map, Icon: Image, Title: Location. Name, Status: Location.Agometry. Location}); Placeholder HTML + = '& lt; Li & gt; + Place.name + '& lt; / Li & gt; '; Bounds.extend (place.geometry.location); } Map.fitBounds (boundary); } Google.maps.event.addDomListener (window, 'load', start);   

With these codes I get names from places, I changed it to type. And now I get a list of types, but they have a comma.

  placesList.innerHTML + = '& lt; Li & gt; + Place.types + '& lt; / Li & gt; ';   

How can I remove a comma? For example, they look like this:

  & lt; Li & gt; Accounting, airport, entertainment_park & ​​lt; / Li & gt; & Lt; Li & gt; Aquarium, art_gallery, atm, bakery & lt; / Li & gt; & Lt; Li & gt; Bank, bar, beauty_salon & lt; / Li & gt;   

I want the comma to be replaced with the place. Can anyone help me?

join

  place Types.join ("")    

No comments:

Post a Comment