【发布时间】:2017-08-03 17:02:34
【问题描述】:
我收到此错误:“您已超出此 API 的每日请求配额。”
目前,表单设置为强制从 API 中选择第一个匹配项。 超过此每日限制时,我不想强制选择第一场比赛。我认为状态 =“OVER_QUERY_LIMIT”会起作用,但事实证明这是我得到的状态 =“ZERO_RESULTS”。
有人知道为什么返回“ZERO_RESULTS”而不是“OVER_QUERY_LIMIT”吗?
这是我的一段代码:
geocoder.geocode({"address": firstResult}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var formattedResult = results[0].formatted_address;
$("#input-location").val(formattedResult);
}
}
if (status == "OVER_QUERY_LIMIT") {
$(".btn-search-submit").removeAttr('disabled');
return;
}
if (status == 'ZERO_RESULTS') {
$(".search-no-results").remove();
$(".btn-search-submit").attr('disabled', true);
$(".pac-container").show();
$(".pac-container").append(
"<div class='search-no-results'>" +
"<p><strong> Sorry, no results</strong></p>" +
"<p>Please check your spelling or try a zipcode</p>" +
"</div>");
setTimeout(function(){
$(".pac-container").hide();
}, 3000);
}
});
}
【问题讨论】:
标签: javascript google-maps-api-3 google-places-api geocoding