Javascript 从函数中调用google maps api
到目前为止,我已将我的google maps api与以下代码集成:Javascript 从函数中调用google maps api,javascript,google-maps,Javascript,Google Maps,到目前为止,我已将我的google maps api与以下代码集成: <script async defer src="https://maps.googleapis.com/maps/api/js?key=GOOGLEKEY&callback=initMap"> </script> 因为现在没有lat和lng 我需要在按钮的onclick函数中加载initMap函数。有人能告诉我怎么做吗?谢谢您需要删除&callback=initMap。然后,您可以从
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=GOOGLEKEY&callback=initMap">
</script>
因为现在没有lat和lng
我需要在按钮的onclick函数中加载initMap函数。有人能告诉我怎么做吗?谢谢您需要删除
&callback=initMap
。然后,您可以从任何需要的位置初始化映射
InvalidValueError: setCenter: not a LatLng or LatLngLiteral: in property lat: not a number