[英]Google map showing NetworkError: 403 Forbidden - http://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent
I was using Google map with one of my application.I had my markup like this 我在其中一个应用程序中使用了谷歌地图。
<div>
<label>Property Location</label>
<input class="text-input" type="text" name="property_location" id="property_location" value=""/>
</div>
I am using gmap3 to show the google map.My js code for showing map is like his 我正在使用gmap3显示谷歌地图。我显示地图的js代码就像他的
jQuery(document).ready(function() {
jQuery('#property_location').blur(function() {
var the_address = jQuery(this).val();
var geocoder = new google.maps.Geocoder();
var latLng = geocoder.geocode({
address: the_address
}, function(results, status) {
/// IF WE HAVE A RESULT
if(status == google.maps.GeocoderStatus.OK) {
lat = results[0].geometry.location.lat();
lng = results[0].geometry.location.lng();
jQuery('#latitude').val(lat);
jQuery('#longitude').val(lng);
jQuery(gMap).gmap3({
get: {
name: 'marker',
all: true,
callback: function(objs) {
jQuery.each(objs, function(i, obj) {
obj.setMap(null);
})
}
},
map: {
options: {
zoom: 10,
center: new google.maps.LatLng(lat, lng)
}
},
marker: {
values: [{ latLng:[lat, lng] }],
//jQuery(console.log(values));
options: {
draggable: true,
icon: new google.maps.MarkerImage(
"http://gmap3.net/skin/gmap/magicshow.png",
new google.maps.Size(32, 37, "px", "px")
),
},
events: {
mouseup: function(marker, event, context) {
//// GETS MARKER LATITUDE AND LONGITUDE
var thePos = marker.getPosition();
var theLat = thePos.jb;
var theLng = thePos.kb;
jQuery('#latitude').val(theLat);
jQuery('#longitude').val(theLng);
},
dragend: function(marker, event, context) {
var thePos = marker.getPosition();
//console.log(thePos);
var theLati = thePos.ob;
var theLngi = thePos.pb;
jQuery('#latitude').val(theLati);
jQuery('#longitude').val(theLngi);
jQuery(this).gmap3({
getaddress:{
latLng:marker.getPosition(),
callback:function(results){
var map = $(this).gmap3("get"),
infowindow = $(this).gmap3({get:"infowindow"}),
content = results && results[1] ? results && results[1].formatted_address : "no address";
if (infowindow){
infowindow.open(map, marker);
infowindow.setContent(content);
} else {
jQuery(this).gmap3({
infowindow:{
anchor:marker,
options:{content: content}
}
});
}
}
}
});
},
}
}
});
} else {
alert('Could not find the latitude and longitude for the address '+the_address);
}
});
});
});
Yesterday it was working fine. 昨天情况很好。 But when I checked today the map it showed me an error in console tab of firefox like this 但是当我今天检查地图时,它在firefox的控制台选项卡中显示了这样的错误
NetworkError: 403 Forbidden - http://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent?
Can someone kindly tell me whats the issue here?Any help and suggestions will be really appreciable. 有人可以告诉我这里有什么问题吗?任何帮助和建议都将是很有意义的。 Thanks 谢谢
ohhh.. I was doing wrong. 哦..我做错了。 I had made download the google map code to my local server and was giving link to the downloaded files.It was the problem. 我已经将谷歌地图代码下载到我的本地服务器上,并提供了到下载文件的链接。这就是问题所在。 I just removed that file and made direct link to the google map code and I got my map working finally... 我刚刚删除了该文件,并直接链接到了谷歌地图代码,我的地图终于可以工作了...
I'm not sure if that's the reason, but there is an issue with your code: 我不确定这是否是原因,但是您的代码有问题:
var theLat = thePos.jb;
var theLng = thePos.kb;
and 和
var theLati = thePos.ob;
var theLngi = thePos.pb;
you try to access properties of the LatLngs( jb
, kb
, ob
, pb
) that are used internally by the API, the names of these properties may change . 您尝试访问API内部使用的LatLngs( jb
, kb
, ob
, pb
)的属性时,这些属性的名称可能会更改。
Use the methods lat()
and lng()
to retrieve latitude and longitude: 使用方法lat()
和lng()
检索纬度和经度:
var theLat = thePos.lat();
var theLng = thePos.lng();
and 和
var theLati = thePos.lat();
var theLngi = thePos.lng();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.