我正在使用谷歌地图 API 3 和谷歌地理编码器。问题是它没有显示标记和信息窗口我通过 ajax 带来数据并调用函数 showAddress(elemId, address) 其中 elementId 是 div id 将在其中呈现地图。这是谷歌地图的代码
<script type="text/javascript">
//<![CDATA[
var geocoder;
var map;
var lat;
var lng;
function showAddress(elemId, address) {
    geocoder = new google.maps.Geocoder();
    geocoder.geocode( { 'address': address}, function(results, status){
//        console.log(results[0].geometry.location.YA);
            lat = results[0].geometry.location.Ya;
            lng = results[0].geometry.location.Za;
                var mapOptions = {
                    zoom: 15,
                    center:  new google.maps.LatLng(lat, lng),
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                };
            map = new google.maps.Map(document.getElementById(elemId),
                    mapOptions)
            $('a#full-'+elemId).attr('href','http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q='+lat+','+lng+'')
            var marker 
            marker = "marker_"+elemId;
            myLatlng = new google.maps.LatLng(lat,lng);
            marker = new google.maps.Marker({
                id:elemId,
                position: myLatlng,
                map: map
            });
            var infowindow = "infowindow"+elemId;
            infowindow  = new google.maps.InfoWindow({
            content: 'Hello world'
            });
            infowindow.open(map, marker);
            google.maps.event.trigger(map, 'resize');
    });
}
</script>