我正在尝试将 Google 地图 API 集成到我的页面。我使用从 JSON 中提取位置并将该位置保存在数组中的代码,然后返回每个位置的位置数据。一切都很顺利,只是我infowindow在点击地图上的标记时无法激活该功能。这是点击时出现的错误:
var map; // declares a global map variable
/*
Start here! initializeMap() is called when page is loaded.
*/
function initializeMap() {
var locations;
var mapOptions = {
disableDefaultUI: true
};
/*
For the map to be displayed, the googleMap var must be
appended to #mapDiv in resumeBuilder.js.
*/
map = new google.maps.Map(document.querySelector('#map'), mapOptions);
/*
locationFinder() returns an array of every location string from the JSONs
written for bio, education, and …Run Code Online (Sandbox Code Playgroud)