【发布时间】:2011-04-26 15:47:22
【问题描述】:
谁能帮我理解为什么下面的代码在第二个警报中没有显示任何内容?浏览到我传递给 getJSON() 的相同 url 会在我的浏览器窗口中产生输出。
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<script>
$.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=Chicago,IL&sensor=false',
function(json, textStatus) {
alert("textStatus:" + textStatus);
var out = '';
for (var i in json) {
out += i + ": " + json[i] + "\n";
}
alert(out);
//alert("JSON Data:" + json.results[0].formatted_address);
});
</script>
</body>
</html>
【问题讨论】:
标签: jquery google-maps