2012-12-18 53 views
10

我想通過Bing地圖實現以下功能。在#content中,將從JSON顯示標記。Jquery Bings地圖Json重新加載

15秒後,所有的標記都應該刪除並重新加載。

加載地圖和標記正常工作。也刪除標記工作。

只有在沒有新的標記更多下載!在控制檯中,我沒有收到錯誤消息。

有沒有人有想法?我懷疑當「下載」出現錯誤時?

驗證碼:

function bings_maps(){ 
    $('#content').gmap({ 
      center: new Microsoft.Maps.Location(47.631296,15.830868), 
      mapTypeId: Microsoft.Maps.MapTypeId.aerial, 
      zoom: 17, 
      credentials: 'test', 
      bounds: null, 
      showMapTypeSelector: false, 
      enableSearchLogo: false, 
      showBreadcrumb: false, 
      enableClickableLogo: false, 
      showScalebar: false, 
          enableSearchLogo: false, 
          showDashboard: false, 
          showMapTypeSelector:false, 
          showScalebar: false, 
          useInertia: false, 
          disablePanning: false, 
          disableZooming: false, 
      callback: function() { 
    var self = this; 
    $.getJSON('inhalt.php', function(data) { 
     $.each(data.markers, function(i, marker) { 
     var location = new Microsoft.Maps.Location(marker.latitude, 
                marker.longitude); 
     self.addMarker({ 'location': location, 'bounds': false , 
        'icon': marker.icon }); 
     }); 
    }); 
    }}); 
} 

function bings_maps_refresh() { 
    $('#content').gmap('clear', 'markers'); 
    $('#content').gmap({'callback':function() { 
     this.addMarker({'location': '47.631296,15.830868', 'bounds': true}); 
}}); 
+1

你的json響應是否經過了成功函數?也許你應該添加一個錯誤函數並首先爲這個函數$ .getJson提示消息 –

回答

1

我懷疑你的迴應數據沒有任何標記的話,請嘗試使用fiddler來檢查數據。或者查看chromes開發工具的網絡區域(F12)。