【发布时间】:2013-05-09 06:24:36
【问题描述】:
我的 application.js 上出现“ReferenceError: google is not defined”错误
这是我的 js 包含的内容:
$(document).ready(function(){
var input = document.getElementById('searchTextField');
var options = {
types: [],
componentRestrictions: {country: 'in'}
};
var autocomplete = new google.maps.places.Autocomplete(input, options);
});
不明白为什么会出现这个错误。我的搜索功能运行正常,但 Web 控制台出现此错误。
谁能告诉解决方案?
【问题讨论】:
-
呃,您是在加载 Google 地图 API JS 文件吗?您可能需要发布更多代码,因为到目前为止您发布的内容中没有这些代码
-
@duncan 这就是我要发布的内容:"searchTextField", :class=> "homecatg" %>
标签: google-maps-api-3 ruby-on-rails-3.2