javascript - Google Maps, over query limit -
i have 14 adresses in json object, want display on map - however, error im on query limit, fine query limit 10 pr second (i think) - however, how display locations on map, without going on query limit? i've tried settimeout() 500ms, im still getting error - appreciated:
$.getjson(apiurl, function( data ) { _.each(data, function(value, key){ //clear markers //deletemarkers(); var link = value.linkurl, address = value.address, content = value.openinghoursmessage; settimeout(function(){ geocodeaddress(link, content, address, map); }, 500); }); });
instead of 14 queries @ once, performing 14 queries @ once after 500ms ... set delay = 0 outside of each loop, @ end of each loop add 500 delay, use delay instead of value 500 in settimeout
a bit this:
$.getjson(apiurl, function (data) { var delay = 0; _.each(data, function (value, key) { //clear markers //deletemarkers(); var link = value.linkurl, address = value.address, content = value.openinghoursmessage; settimeout(function () { geocodeaddress(link, content, address, map); }, delay); delay += 500; }); });
Comments
Post a Comment