在javascript中加载错误的Google地图
我是javascript新手,在google maps上做了一个演示,对我来说有趣的是,我在v2中做了演示,然后通过更改url将其更改为google maps api v3。因此,现在我的地图加载成功,但出现以下错误。 日志在javascript中加载错误的Google地图,javascript,cordova,google-maps,google-maps-api-3,Javascript,Cordova,Google Maps,Google Maps Api 3,我是javascript新手,在google maps上做了一个演示,对我来说有趣的是,我在v2中做了演示,然后通过更改url将其更改为google maps api v3。因此,现在我的地图加载成功,但出现以下错误。 日志 Uncaught TypeError: Cannot read property '__e3ae_' of undefinedS.trigger @ js?sensor=false&v=3.5&_=1449578432459:42appCinico.onSu
Uncaught TypeError: Cannot read property '__e3ae_' of undefinedS.trigger @ js?sensor=false&v=3.5&_=1449578432459:42appCinico.onSuccess @ index.js:449
我的代码如下:
index.html
function init()
{
console.log("I am here");
var mapOption = {
// center: latLong,
zoom: 10,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true
};
map = new google.maps.Map(document.getElementById("map_canvas"), mapOption);
}
function loadScript() {
$.ajax({
// url: 'https://maps.googleapis.com/maps/api/js?key=AIzaSyADAgC6Payul6axiClP_z1stx8lBY2pUyE&callback=init',
url : 'http://maps.google.com/maps/api/js?sensor=false&v=3.5',
dataType: 'script',
timeout: 300,
success: function () {
// alert("success:");
},
error: function () {
// alert("error:");
}
});
}
success:function(){init()},
google.maps对象以前不可用success@aishwatsingh-Som应进行哪些代码更改;,我为这个做了什么?你所有的url:'https://maps.googleapis.com/maps/api/js?key=AIzaSyADAgC6Payul6axiClP_z1stx8lBY2pUyE&callback=init“,
加载javascript并调用init函数,但现在从ajax加载脚本,所以在加载脚本后,可以使用google.maps,这是y,只需更换success
part并在success callback中调用init
,有时我的地图标记也未加载。好了,现在您至少可以获取地图了吗?有关标记,请参阅