问题
Here I have a code for creating map and sibar with links, but in infowindow all is ok, and in sidebar I only get undefined text:
http://jsbin.com/EVEWOta/23 (just click submit)
So what is exactly the problem?
CODE:
var side_bar_html = "<a href='javascript:google.maps.event.trigger(gmarkers["+parseInt(gmarkers.length-1)+"],\"mouseover\");'>"+place.name+"</a><br>";
document.getElementById('side_bar').innerHTML += side_bar_html;
}
回答1:
You are using RadarSearch.
From the documentation:
PlaceResult objects returned by radarSearch() will only include the geometry.location and reference properties.
There is no .name property
来源:https://stackoverflow.com/questions/18499291/undefined-objects-from-json-with-javascript