【发布时间】:2013-09-24 20:47:58
【问题描述】:
我正在加载Google Maps API、jQuery 和这个Geocomplete 插件。 请注意,我还指定了库 (libraries=places) 并最终指定了我的 API 密钥:
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
<script src='http://maps.googleapis.com/maps/api/js?v=3&sensor=false&libraries=places&key=xxx'></script>
<script src='js/vendor/jquery.geocomplete.js'></script>
我在页面加载时触发 Geocomplete 插件
$(window).load(function () {
$('#my-input').geocomplete();
});
但我总是收到错误:
Uncaught TypeError: Cannot read property 'Autocomplete' of undefined [jquery.geocomplete.js:153]。
插件内部...
this.autocomplete = new google.maps.places.Autocomplete(
this.input, options
);
我尝试 google.maps 并返回一个常规对象,但地点是 未定义!
【问题讨论】:
标签: javascript jquery google-maps