【发布时间】:2018-07-08 03:00:35
【问题描述】:
我正在尝试绘制 USGS 地震数据,但遇到了一个非常奇怪的问题。我的查询获取所有结果并绘制第一个结果,但其余结果附加在地图顶部。
function getEarthquakes(){
jQuery.ajax({
type: "GET",
dataType: "json",
url: "data/earthquakes-today.json",
error: function (err) { console.log(err)},
success: function (results, status, xhr) {
jQuery(results.features).each(function(index, i) {
L.marker([i.geometry.coordinates[0], i.geometry.coordinates[1]]).bindPopup(i.geometry.coordinates[0]+", "+i.geometry.coordinates[1]).addTo(map);
});
}
})
}
知道是什么原因造成的吗?没有控制台日志错误,当我 console.log 得到结果时:
【问题讨论】:
标签: jquery json leaflet mapbox