我正在尝试从 db mysql 显示标记。没有显示数据。
http://www.nexusmultimedia.it/gis7.html
<script>
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade, Points © 2012 LINZ',
cloudmade = L.tileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
latlng = L.latLng(45.4404,12.3768);
var map = L.map('map', {center: latlng, zoom: 11, layers: [cloudmade]});
var markers = L.markerClusterGroup();
function getUsers() {
$.getJSON("get_info.php", function (data) {
for (var i = 0; i < data.length; i++) {
var location = new L.LatLng(data[i].lat, data[i].lng);
// var
var name = data[i].nome;
var marker = new L.Marker(location);
marker.bindPopup("<div style='text-align: center; margin- left: auto; margin-right: auto;'>"+ name +"</div>",
{
maxWidth: '400'
});
users.addLayer(marker);
}
})
};
</script>
从 www.nexusmultimedia.it/get_info.php 我可以看到:
[{"cf_id":"1","nome":"Cofano","lat":"45.475281","lng":"12.26436"}]
浏览器 chrome 没有错误,但没有显示标记。任何想法?
谢谢
尼古拉