Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API 3 - Type error: a is undefined

I'm attempting to dynamically load geocodes from a json file here http://debug-gotfed.admin.zope.net/bataviaeats/at/dev_remote_content

I'm getting a "Type Error: a is undefined." What am I missing?

<script type="text/javascript">

  // Global

  var infowindow;
  var markers_img = 'http://gotfed.in/!/assets/global_images/got-fed-in-marker.png';
  var infoCloseIcon = 'images/close.png';
  var infoCloseMargin = '4px 4px 2px 2px';

  function initialize() {
    var mapOptions = {
      center: new google.maps.LatLng(58, 16),
      scrollwheel: false,
      mapTypeControl: false,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

    $.each(locations, function(i, data) {
      console.log(data.geocode);
      var position = new google.maps.LatLng(data.geocode);
      var marker = new google.maps.Marker({
          position: position,
          map: map,
          icon: markers_img
        });
      console.log(marker);
      // marker.setMap(map);
    });
  }
  google.maps.event.addDomListener(window, 'load', initialize);

  </script>
like image 803
Bryan Wengren Avatar asked Oct 31 '13 10:10

Bryan Wengren


1 Answers

You are either having the firebug console open when loading the page or one of firefox extension clogging the downloading, making the browser can not get full script from google.

Solution: turn of firebug console, if that's not the case, then try disable the extensions individually see what conflict.

like image 71
angry kiwi Avatar answered Oct 11 '22 08:10

angry kiwi