我正在尝试从 json 提要中的“农场”值开始构建 url 到 photsets 的拇指。我不明白为什么这不起作用..?
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
function ajax_get_json(){
var menu = document.getElementById("menu");
var thumbURL = new XMLHttpRequest();
thumbURL.open("GET", "http://api.flickr.com/services/rest/?&method=flickr.photosets.getList&api_key=797507e576c902b2ffb0c8494fb368ab&user_id=37003559@N03&format=json&jsoncallback=?", true);
thumbURL.setRequestHeader("Content-type", "application/json", true);
thumbURL.onreadystatechange = function() {
if(thumbURL.readyState == 4 && thumbURL.status == 200) {
var data = JSON.parse(thumbURL.responseText);
menu.innerHTML = "";
for(var obj in data){
menu.innerHTML += data[obj].photosets.photoset.id+"<hr />";
}
}
}
thumbURL.send(null);
menu.innerHTML = "requesting...";
}
</script>
</head>
<body>
<div id="menu"></div>
<script type="text/javascript">ajax_get_json();</script>
</body>
</html>
我错过了什么..?