Tag: google api

在bootstrap模式上显示地图

我想在bootstrap模式上显示一个新的谷歌地图但它似乎不起作用。 请帮忙 $scope.show = function (lat, long) { $(‘#body’).append(”) enter code here$scope.newMap=new google.maps.Map(document.getElementById(‘map’), { zoom: 14, center: {lat: 37.77, lng: -122.447}, mapTypeId:’roadmap’ });

谷歌柱形图有两列

有月份和年份时如何处理柱形图 。 我的数据采用这种格式 [‘Group’,’Count’,’Month’,’Year’], [‘A’,10,’February’,2015], [‘B’,8,’February’,2015], [‘C’,15,’February’,2016] 目的是创建一个柱形图,其中X轴为月 , Y轴为Count 。 现在X轴应该按月分组计数。 像这样的东西 – 我试图简单地传递上面的数据,看看我能得到什么,但我得到错误。 是否可以根据按月分组的年份为Axis分配值? 谷歌图表示例的JsFiddle

我可以在Google Loader运行后运行JavaScriptfunction吗?

我正在使用google.load()加载Google API,我需要处理一些由它构建的内容,但我需要在它已经完全加载后运行JavaScript,有没有办法确保发生? 这是我如何构建图像列表,我需要为每个img标签添加一个属性,但是在它构建完成之后才能这样做? google.load(“feeds”, “1”); function initialize() { var feed = new google.feeds.Feed(“myfeed.rss”); feed.load(function(result) { if (!result.error) { var container = document.getElementById(“feed”); for (var i = 0; i < result.feed.entries.length; i++) { var entry = result.feed.entries[i]; var entryTitle = entry.title; var entryContent = entry.content; imgContent = entryContent + "”+entryTitle+””; var div = document.createElement(“div”); div.className = […]

如何根据Google Books API表示和自动填充建议的JSON?

此问题基于使用Google Books API的建议结果无关紧要 。 一般来说,我正在建立用户将书籍添加到他的collections中的可能性。 为此,用户使用Google图书中的信息搜索图书。 但是如果没有基于搜索字段中用户类型的建议,那将非常不舒服。 此时我们现在收到书籍建议的jSON文本,但我真的不明白如何表示这一点? 那么如何创建该JSON的正常列表并为用户创建其中一个推荐的可能性,以便在点击时在搜索字段中自动完成每个推荐? var requestUrl = “https://suggestqueries.google.com/complete/search?client=chrome&ds=bo&q=”; var xhr; $(document).on(“input”, “#query”, function () { typewatch(function () { var queryTerm = $(“#query”).val(); $(“#indicator”).show(); if (xhr != null) xhr.abort(); xhr = $.ajax({ url: requestUrl + queryTerm, dataType: “jsonp”, success: function (response) { $(“#indicator”).hide(); $(“#output”).html(response); } }); }, 500); }); $(document).ready(function () […]

谷歌网络服务按位置获取时间?

可能重复: 如何在任何位置获取当前时间 我听说过开放的Google WebServices即地图,我想知道谷歌的时间,货币和其他function有类似的东西。 关于时间我发现了类似的问题,但我想要一些商业用途的解决方案: 如何在任何位置获取当前时间哦,我想通过AJAX(客户端)调用它。 想法是在世界各地的一些城市提供下拉列表,一旦选择了城市,应该显示城市的当地时间。 我找到一个算法来包含所有各种Summertime-Changes的问题,所以这种方法似乎更容易。

未捕获的SecurityError:阻止具有原始“https://www.google.com”的框架访问具有原始“http://my.site.com”的框架。

我正在使用谷歌reCaptcha v2.0,当我尝试使用示例html页面时,这是在同一个域中工作但是当我尝试与完整生产页面集成时,同样的事情不起作用。 点击reC​​aptcha复选框后,它会继续加载,有时会在下面详细说明错误。 Uncaught SecurityError: Blocked a frame with origin “https://www.google.com” from accessing a frame with origin “http://my.site.com”. The frame requesting access has a protocol of “https”, the frame being accessed has a protocol of “http”. Protocols must match. 我已经尝试删除http,https并保持//以便网站协议可以匹配但没有运气。 如果有人在这里有解决方案,那将是一个很大的帮助。 提前致谢。

当文本输入其中一个选项的相同值时,触发Google商家信息自动填充位置已更改

我正在使用Google Places Autcomplete API和jQuery。 它的基本function正常。 我想要做的是,如果有人在自动完成中输入了与我希望选择的项目和要触发的place_changed事件的选项之一完全相同的内容。 这是因为我在需要触发的地方改变了监听器中的一些逻辑。 这个想法是,如果有人输入与自动完成选项之一完全相同的文本,那么它应该像有人点击该选项一样。 这是我尝试过的,其中userLocation是输入: $(“#userLocation”).keyup(function(e){ //if the text is at least 4 chars long if($(“#userLocation”).val().length > 4) { //iterate through each of the autocomplete options $(“.pac-item”).each(function(){ if($(this).text() == $(“#userLocation”).val() ) { //does not do what I need it to $(this).trigger(“place_changed”); } }); } }); 我也尝试用.trigger(“click”)替换trigger(“place_changed”) ,但无济于事。 有没有人这样做过? 任何人都可以建议另一种方法来尝试使这项工作? 任何建议将非常感谢,谢谢!

使用“后备脚本”从WordPress中的Google AJAX Libraries API加载jQuery

我添加了一个Wordpress函数来从Google Hosted Libraries加载jQuery库 if (!is_admin()) add_action(“wp_enqueue_scripts”, “my_jquery_enqueue”, 11); function my_jquery_enqueue() { wp_deregister_script(‘jquery’); wp_register_script(‘jquery’, “http” . ($_SERVER[‘SERVER_PORT’] == 443 ? “s” : “”) . “://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js”, false, null); wp_enqueue_script(‘jquery’); } 它创造了这样的东西 根据html5boilerplate建议,如何将其与fallback选项一起包含在内 window.jQuery || document.write(”) 像这样

结帐距离使用WooCommerce 3.3中的Google Map API进行计算

几个月前我发布了一个类似的问题 ,我得到了帮助解决它。 它在Woocommerce版本3.1.2之前工作正常。 我一直在更新到最新版本的WooCommerce,希望问题能够得到解决。 我根据结账时客户的billing_area (自定义下拉列表)与卖家的billing_city (在用户个人资料中设置)之间的差异添加动态费用。 我使用的代码如下 – 这是运行的jQuery脚本,以使billing_area的值更改为: add_action( ‘woocommerce_after_checkout_form’, ‘custom_checkout_jquery_script’, 10 ); function custom_checkout_jquery_script() { ?> (function($){ $( ‘form.checkout’ ).on( ‘change’, ‘#billing_area’, function(){ var location = $(‘#billing_area option:selected’).val(); document.cookie=”cusarea=”+location; // Browser console output (Just for testing) function readCookie(n){ for(var r=n+”=”,t=document.cookie.split(“;”),e=0;e<t.length;e++){ for(var i=t[e];" "==i.charAt(0);)i=i.substring(1,i.length); if(0==i.indexOf(r))return i.substring(r.length,i.length)}return null} $('body').trigger('update_checkout'); console.log('Selected Area: '+location+' | Cookie: […]

使用Google Books API的推荐结果无关紧要

我正在尝试使用Google Books API构建书名推荐系统。 不幸的是,与https://books.google.com相比,我得到的结果非常无关紧要。 例如,这是我从搜索单词“sher”得到的列表(期待主要是像Sherlock Holmes这样的东西)。 `She Said Yes;The Oh She Glows Cookbook;What Can She Know?;She-Wolf;Murder She Wrote;My Mother She Killed Me, My Father He Ate Me;22 Things a Woman Must Know If She Loves a Man with Asperger’s Syndrome;Where She Danced;The Israeli-Palestinian Peace Negotiations, 1999-2001` 如你所见,甚至没有最相关的标题。 如果您在Google图书网站上输入“Sher”,您将获得绝对正确的相关建议。 我了解Google API吗? 我的代码有什么问题? var request = ‘https://www.googleapis.com/books/v1/volumes’; […]