0

我不知所措,我无法读取包含 geoJSON 字符串的外部 url ( http://earthquake.usgs.gov/earthquakes/feed/geojson/1.0/hour )。我尝试使用此脚本:

.ajax({
 type: "GET",
 url: 'http://earthquake.usgs.gov/earthquakes/feed/geojson/1.0/hour',
 dataType: 'json',
 success: function(data) {
 alert(data.features[0].properties.mag);
 } 
 });

我还尝试使用 URL 加上 '&callback=foo' 并设置 foo 函数。

我不知道该怎么做才能阅读这个外部网址。我想读取获取 json 字符串或作为文本字符串。请帮我解决它。

4

0 回答 0