我有以下代码,我想在这里调用初始化函数;google.maps.event.addDomListener(window, 'load', 初始化);
但是我收到了这个错误;错误:未定义初始化。
这里有什么问题?
$(function CheckinMap() {
$.ajax({
type: "GET",
url: "content/home/index.cs.asp?Process=ViewCheckinMap",
success: function initialize(data) {
var center = new google.maps.LatLng(48.404840395764175, 2.6845264434814453);
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 2,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP,
maxZoom: 4
});
var markers = [];
for (var i = 0; i < data.users.length; i++) {
var location = data.users[i];
var latLng = new google.maps.LatLng(location.latitude,
location.longitude);
var marker = new google.maps.Marker({
position: latLng
});
markers.push(marker);
}
var markerCluster = new MarkerClusterer(map, markers);
},
error: function (data) {
$("#checkinmap").append(data);
}
});
});
google.maps.event.addDomListener(window, 'load', initialize);