Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery、googlemapsapi、a为空,每次重新加载都会显示不同数量的位置标记_Jquery_Google Maps - Fatal编程技术网

jQuery、googlemapsapi、a为空,每次重新加载都会显示不同数量的位置标记

jQuery、googlemapsapi、a为空,每次重新加载都会显示不同数量的位置标记,jquery,google-maps,Jquery,Google Maps,好吧,这是一张行为不端的地图 已编辑,以避免在开发站点中产生超过所需流量的流量 我甚至不知道从哪里开始。Javascript从来都不是我的强项,这让我毛骨悚然 代码如下: jQuery(document).ready(function($) { var options = { maptype: G_PHYSICAL_MAP,

好吧,这是一张行为不端的地图

已编辑,以避免在开发站点中产生超过所需流量的流量

我甚至不知道从哪里开始。Javascript从来都不是我的强项,这让我毛骨悚然

代码如下:

jQuery(document).ready(function($)
{               

        var options = { 
                maptype: G_PHYSICAL_MAP,                                                
                controls: false,
                zoom: 3         
        };                              

        var shows = new Array();                
        var i = 0;                              

        $('.show-item').each(function() 
        {                                       
                showLocation = $(this).find('.show-location').html();
                description = "<em>" + $(this).find('.show-date').html() + "</em>"; 
                description += $(this).find('.show-title').html();                description += "<br />";
                description += $(this).find('.show-description').html();                
                if($(this).find('.ticket-link').length > 0)                             
                {       
                        description += $(this).find('.ticket-link').html();             
                }                                                                       

                shows[i] = {address: showLocation, html: description};
                i++;
        }); 

        options.markers = shows;

        console.log(options);

        $("#map").gMap(options);
});  
jQuery(文档).ready(函数($)
{               
变量选项={
地图类型:G_PHYSICAL_地图,
控件:false,
缩放:3
};                              
var shows=newarray();
var i=0;
$('.show item')。每个(函数()
{                                       
showLocation=$(this.find('.show location').html();
description=”“+$(this.find('.show date').html()+“”;
description+=$(this.find('.show title').html();description+=“
”; description+=$(this.find('.show description').html(); if($(this).find('.ticket链接')。长度>0) { description+=$(this.find('.ticket link').html(); } 显示[i]={地址:showLocation,html:description}; i++; }); options.markers=显示; console.log(选项); $(“#地图”).gMap(选项); });

谢谢

你从谷歌得到620个状态码,这意味着你的查询速度太快了——javascript要求地理编码器每秒对你的基本地址进行太多次锁定

解决方案是以某种方式将Lat/Lng预烘焙到数据中。我知道这听起来很痛苦,但你必须这样做,或者在计时器上动态添加标记



根据我阅读回复的方式,顺便说一句,看起来你一次可以做20个——再也不能做了。

你从谷歌那里得到了620个状态码,这意味着你查询得太快了——javascript要求地理编码器每秒对你的基本地址进行太多次锁定

解决方案是以某种方式将Lat/Lng预烘焙到数据中。我知道这听起来很痛苦,但你必须这样做,或者在计时器上动态添加标记



根据我阅读回复的方式,顺便说一句,看起来你一次可以做20个批次——不多了。

好吧,至少你知道如何让它工作。有时最好至少知道为什么有些东西不起作用(尽管有时无知是幸福)好吧,至少你知道怎么做。有时最好至少知道为什么有些东西不起作用(尽管有时无知是幸福)