-1
나는 SSL을 사용하는 www.hosting6280514.az.pl/ 웹 사이트를 가지고있다. 나는 그 페이지에 Google지도를 표시하려고 시도하지만, 컨트롤, 마커 및지도/위성 스위치 만있다. 실제지도는 표시되지 않습니다. 이것은 내가 사용하고있는 코드입니다 :Google Maps API JS3 SSL
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map-canvas {
margin: 0;
padding: 0;
height: 100%;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var map;
function refreshing() {
setTimeout("location.reload(true);",5000);
}
function initialize()
{
var position = new google.maps.LatLng(<?php echo$lat; ?>,<?php echo$lgt; ?>);
var mapOptions =
{
zoom: 18,
center: position,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
/*var image = new google.maps.MarkerImage('http://hosting6280514.az.pl/pawel/images/car.png',
// This marker is 129 pixels wide by 42 pixels tall.
new google.maps.Size(129, 42),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 18,42.
new google.maps.Point(18, 42)
);*/
var marker = new google.maps.Marker(
{
position: position, // its position is where position variable points
title: "Car's position"
//icon: image
});
marker.setMap(map); // To add the marker to the map, call setMap();
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body onload="JavaScript:refreshing();">
<div id="map-canvas"></div>
</body>
</html>
죄송합니다. 질문 :지도가 표시되지 않는 이유를 아는 사람이 있습니까?
왜 페이지에'setTimeout'이로드되어 있습니까? – Samer
입니다.지도가 마커의 새 위치를 업데이트하기 위해 매 5 초마다 새로 고침되기 때문입니다. 거기에 AJAX를 사용하지 않고 어떤 대안이 있습니까? – Pawel
지금 AJAX를 사용하고 있지 않습니다. 너는 너라고 생각하니? 왜 페이지 전체를 다시로드하고지도를 다시 초기화하는 것은 AJAX로 마커 위치를 업데이트하는 것보다 데이터 및 API로드가 훨씬 비쌉니까? – geocodezip