2014-04-10 3 views
0

이것은 tutorial (Google)에서 가져온 내 스크립트입니다. 마커를지도에 표시 할 수 없습니다. Json이받는 모든 데이터를 경고하려고하지만 팝업되지 않습니다. 나는 방화범 검사관에게 실수를하지 않아서 단서를 얻을 수있다.json을 통해 Google지도에 아이콘 추가

<script type="text/javascript"> 
    $(document).ready(function() { 

$('#map_canvas').gmap().bind('init', function() { 
    $.getJSON('http://jquery-ui-map.googlecode.com/svn/trunk/demos/json/demo.json', function(data) { 
     $.each(data.markers, function(i, marker) { 
      alert(marker.latitude); 

      $('#map_canvas').gmap('addMarker', { 
       'position': new google.maps.LatLng(marker.latitude, marker.longitude), 
       'bounds': true 
      }).click(function() { 
       $('#map_canvas').gmap('openInfoWindow', { 'content': marker.content }, this); 
      }); 

     }); 
    }); 
}); 

}); 
    </script> 

답변

1

당신은 아약스를 통해 (그들이 적절한 헤더를 보내 제외하고,이 파일의 경우 것이 아니다) 다른 도메인에서 파일을 액세스 할 수 없습니다. demo.json을 다운로드하여 자신의 서버/도메인에 배치하십시오.

관련 문제