gpt4 book ai didi

jquery - geocomplete_rails 和 Uncaught ReferenceError : google is not defined

转载 作者:行者123 更新时间:2023-12-01 04:05:39 25 4
gpt4 key购买 nike

我正在尝试使用 geocomplete_rails gem:https://github.com/guyisra/geocomplete_rails

我的 application.js 文件如下所示:

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require moment
//= require bootstrap-datetimepicker
//= require geocomplete
//= require_tree .

$(function() {
$('#event_raw_location').geocomplete();
});

当我打开包含 #event_raw_location 元素的表单页面时,出现 Uncaught ReferenceError: google is not Define 错误,并且自动完成功能不起作用。知道为什么吗?

最佳答案

来自 here 中的文档看起来你应该再添加一个 JavaScript。

尝试在您的app/views/layouts/application.html.erb中添加以下行:

<script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places"></script>

行前:

<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>

希望有帮助!

关于jquery - geocomplete_rails 和 Uncaught ReferenceError : google is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29208416/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com