10

I would like to achieve the following with Bing Maps. In #content, markers will be displayed from JSON.

After 15 seconds, all markers should be deleted and reloaded.

Loading the map and markers work fine. Also delete the markers work.

Only after no new marker more downloaded! In the console, I get no error message.

Does anyone have an idea? I suspect that when the "Download" an error happened?

The Code:

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});
}});
Bojin Li
  • 5,769
  • 2
  • 24
  • 37
  • 1
    does your json response go through success function? maybe you should add an error function and alert the message first for this function $.getJson – radu florescu Jan 17 '13 at 10:24

1 Answers1

1

I suspect that your response data doesn't have any markers in it, try using fiddler to check the data. Or check out the network area of chromes development tools (F12).

Hayden Crocker
  • 509
  • 4
  • 15