Google Maps Places API: TypeError: autocomplete is undefined
Google Maps Places API: TypeError: autocomplete is undefined
每当我尝试使用谷歌地图API地点库时,它都会在浏览器的控制台中给我这个错误:
TypeError: autocomplete is undefined
如果我没记错的话,这意味着地方库无法加载。至于代码,我有自己的代码,但我也从 Places API 教程(https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform)中复制粘贴了代码。
在我的标题中,我包含以下两行:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MY_KEY_HERE"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
我还确保Placis API,Google Maps JavaScript API v3和Google Maps Geolocation API都在我的Google API控制台中打开。
我不太确定问题是什么,除了地方库没有加载。我应该注意我正在处理一个隐藏的子域,这可能是问题所在吗?
提前谢谢。
请确保只加载一次映射文件(并且应始终通过https或使用活动的protocl加载api):
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?key=MY_KEY_HERE&libraries=places&sensor=false"></script>
子域应该不是问题,因此您可以使用它。
相关文章:
- Is onfling available for html, html5
- jQuery is not loaded
- reactRedux is not defined
- ReferenceError: cordova is not defined @ng-cordova.min.js:7
- Jquery - table.row(tr) is undefined
- autocomplete不接受源的json对象
- contentWindow.document.body is null
- Tomcat websocket is not working
- noty.js is returning undefined
- $routeParams is undefined
- NodeJS Multer is not working
- React, Webpack: bundle.js is not generated
- jQuery is not defined - WordPress footer.php
- 谷歌地图API v3:Initial View is Fine,but Gray Box with No Map if
- imageArray[i] = imageItem is incompatible
- GAPI Is Not Defined
- Angular2 rc1, where is shims_for_IE
- Is (!~index) faster than (index === -1)?
- Mouse Out Orange Div "CurrentHeight" is not applyi
- Google Maps Places API: TypeError: autocomplete is undefined