10

我想用 Bing Maps 实现以下目标。在#content中,标记将从 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});
}});
4

1 回答 1

1

我怀疑您的响应数据中没有任何标记,请尝试使用提琴手检查数据。或者查看chromes开发工具的网络专区(F12)。

于 2013-01-24T10:01:50.360 回答