google.maps.places is undefined

前端 未结 2 1339
名媛妹妹
名媛妹妹 2020-12-14 07:12

I have a website that loads 3 seperate \"views\" of a location via Google Maps, Street and Places.

Please see my code below:

I have finally gotten Maps and S

相关标签:
2条回答
  • 2020-12-14 07:19

    You should add the option libraries=places in the Google API URL

    In your case you should replace the following:

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&key=....&sensor=false&callback=initializeMap"></script>
    

    With this:

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&key=....&sensor=false&callback=initializeMap&libraries=places"></script>
    

    Look at the end of the src=""

    0 讨论(0)
  • 2020-12-14 07:30

    Now, you have to use https instead of http.

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&key=....&sensor=false&callback=initializeMap&libraries=places"></script>

    Everything else is same as previous answer mentioned.

    0 讨论(0)
提交回复
热议问题