处理403错误-Google地图w/jQuery.getScript

处理403错误-Google地图w/jQuery.getScript,jquery,google-maps,http-status-code-403,Jquery,Google Maps,Http Status Code 403,我正在使用jQuery.getScript使用API键动态加载google地图 jQuery.getScript("http://maps.googleapis.com/maps/api/js?sensor=false&key=APPKEY&callback=initMap", function(data, textStatus, jqxhr) { console.log(textStatus); //success console.log('Load was per

我正在使用jQuery.getScript使用API键动态加载google地图

jQuery.getScript("http://maps.googleapis.com/maps/api/js?sensor=false&key=APPKEY&callback=initMap", function(data, textStatus, jqxhr) {
   console.log(textStatus); //success
   console.log('Load was performed.');   
   console.log(jqxhr.status); //200
});


function initMap(){
var mapOptions = {          
center: new google.maps.LatLng(25.245178, 55.359438),           
zoom : 15,
mapTypeId : google.maps.MapTypeId.ROADMAP,
mapTypeControl : false   
};        
var map = new google.maps.Map(document.getElementById("map_canvas"),             mapOptions);      

} 
地图现在加载并正常工作,并将“200”记录为
jqxhr.status

有了
getScript
API,我是否能够处理403错误,如果它是为超过查询限制而抛出的

我将获得
jqxhr.status=403
还是应该使用
fail(callback)
方法

我使用的是Jquery v1.7.2

看看:


我浏览了文档,但是我能处理Google Map API的403错误吗?您必须使用getScript处理403错误的任何其他链接?任何4xx状态代码显然都是错误,因此将在fail()处理程序中处理。您试图解决什么问题?我认为API的加载不会返回超过查询限制的结果。@geocodezip那么,什么时候会抛出这个超过查询限制的结果呢?我已经添加了我的initMap回调。请给出建议。当您调用一个web服务或一个javascript服务(即Geocoder或directionsService)时,如果您超过了它的配额或速率限制,则会发生OVER_QUERY_LIMIT错误。我已经给出了代码
initMap
,我刚刚使用的是
google.maps.LatLng(纬度,经度)
,所以它不会在任何时候给我
超限查询
错误,对吗?@geocodezip,请确认您关于超限查询根本原因的声明。如果我只使用google.maps.LatLng(knownlat,knownlon)我不会在任何时候超限查询,对吗?
$.getScript("ajax/test.js")
.done(function(script, textStatus) {
  console.log( textStatus );
})
.fail(function(jqxhr, settings, exception) {
  $( "div.log" ).text( "Triggered ajaxError handler." );
});