【发布时间】:2010-06-03 12:32:40
【问题描述】:
我在加载 google maps api 时遇到问题。
我得到了我自己的对象,它带有一个初始化地图的函数,并且通过 jquery.getscript 加载了谷歌地图 api。但我总是在回调函数中收到错误消息:
var MyGMap = {
GMapScriptURL: "http://maps.google.com/maps?file=api&v=2&async=2&key=",
Map: null,
Geocoder: null,
InitiazlizeMaps: function () {
if (GBrowserIsCompatible()) {
this.Map = new GMap2(document.getElementById("map_canvas"));
this.Map.setCenter(new GLatLng(37.4419, -122.1419), 13);
this.Geocoder = new GClientGeocoder();
}
}
}
$(function(){
var CurrentKey = "MY_KEY";
$.getScript(MyGMap.GMapScriptURL + CurrentKey, function () {
MyGMap.InitiazlizeMaps();
// throws GMap2 is undefined
});
});
怎么了?为什么这没有运行?
【问题讨论】:
-
您收到的错误信息是什么?
标签: jquery google-maps