2013-09-21 62 views
0

我有一个单独的谷歌地图v3代码。只需在我的谷歌融合kml图层中显示infowindow信息框,当我点击它时。昨天我的代码工作正常。我没有做任何改变。但今天我的addListner不工作。当我复制我的备份项目,与代码相同。它再次工作,但明天再次发生。我的addListener不起作用。谷歌地图addListener无法正常工作

这里是我的代码

infoBubble = new InfoBubble({ 
    map: map, 
    shadowStyle: 1, 
    padding: 5, 
    borderRadius: 4, 
    arrowSize: 20, 
    borderWidth: 1, 
    borderColor: '#2c2c2c', 
    disableAutoPan: true, 
    hideCloseButton: false, 
    backgroundClassName: 'phoney', 
    arrowStyle: 2, 
}); 

function get_details(mode,id,lati,lng) 
    { 
    $('#loading').show(); 
     if (xhr != null) 
     { 
      xhr.abort(); 
     } 
     xhr = $.ajax({ 
      type: "GET", 
      url: "realisasi2.php?id="+id, 
      data: "m="+mode+"&id="+id, 
      success: function(ret){ 
       ajaxres = JSON.parse(ret); 
       iconpos = new google.maps.LatLng(lati,lng); 
       psbchurndata = ajaxres.detail; 
       var html = psbchurndata+"<i><a class='ajax' href='#' onclick=layer22("+id+","+lati+","+lng+") style='font-family: Arial;font-size: 12px; color:#00CC29;'>Lihat Datel </a></i>"; 
       infoBubble.setContent('<div class="infowindow"><br />'+html+'</div>'); 
       infoBubble.setPosition(iconpos); 
       infoBubble.close(); 
       infoBubble.open(map); 
       $('#loading').hide(); 
      } 
     }); 
    } 


layer.setMap(map); 
google.maps.event.addListener(layer, 'click', function(e) { 

alert(JSON.stringify(e, null, 4)); //UNDIFINED not Working 

    var lati = e.latLng['mb']; 
    var lng = e.latLng['nb']; 
    var x = e.row['id_witel'].value; 
    get_details('w',e.row['id_witel'].value,lati,lng);  
}); 


} 

感谢的任何帮助

+1

我已经看到了类似的问题:有时一个“老”融合表层上点击的结果是不确定的lng()。 – geocodezip

回答

0

有没有 “官方” 性质mbnbgoogle.maps.LatLng(这就是e.latLng是)。这些属性将在API内部使用,这些属性的名称可能会改变下一个时刻,小时或日期。

要检索的纬度和经度使用的方法lat()e.latLng

+0

THANK'S It works:D – firman

相关问题