Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery Bings Maps Json reload

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});
}});
like image 863
Christopher Weber Avatar asked Dec 18 '12 10:12

Christopher Weber


1 Answers

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).

like image 136
Hayden Crocker Avatar answered Oct 13 '22 16:10

Hayden Crocker