这是 JSON 输出的内容
{
"created_at": "Wed, 09 May 2012 22:13:32 +0000",
"from_user": "EastCClothing",
"from_user_id": 119699125,
"from_user_id_str": "119699125",
"from_user_name": "Tester23",
"geo": {
"coordinates": [
54.9742,
-1.5974
],
"type": "Point"
},
"id": 200347799861198850,
"id_str": "200347799861198849",
"iso_language_code": "pt",
"metadata": {
"result_type": "recent"
},
"profile_image_url": "http://a0.twimg.com/sticky/default_profile_images/default_profile_0_normal.png",
"profile_image_url_https": "https://si0.twimg.com/sticky/default_profile_images/default_profile_0_normal.png",
"source": "<a href="http://twitter.com/download/android" rel="nofollow">Twitter for Android</a>",
"text": "#CM0655 GEO",
"to_user": null,
"to_user_id": 0,
"to_user_id_str": "0",
"to_user_name": null
},
我想要做的是获取坐标,以便我可以将它们与谷歌地图 api 一起使用,我可以访问所有其他详细信息,但无法通过我预期的 'json.results [ i].geo.coordinates'。这是我的 jQuery
$(function(){
function searchTweets() {
var url='http://search.twitter.com/search.json?callback=?&q=cm0655';
$.getJSON(url,function(json){
var output = [];
for (var i = 0, len = json.results.length; i < len; i++) {
output.push('<p id="tweet"><img id="tweetImage" src="' + json.results[i].profile_image_url + '" width="48" height="48" /><span id="tweetText">' + '<a href="http://twitter.com/' + json.results[i].from_user + '">' + json.results[i].from_user + "</a> " + json.results[i].text + "<br />" + json.results[i].created_at + '</p>' + json.results[i].geo.coordinates + '</span>');
}
$("div.twitter2").html(output.join('')).slideDown('slow');
});
}
var timer = setInterval(searchTweets, 20000);
searchTweets();
});
非常感谢