我正在尝试将推文绘制到谷歌地图,但位置始终未定义,其他一切正常,如果我使用实际的位置字符串,再次,很好。我检查了 JSON 并指定了位置。
有人知道我做错了什么吗?
我的代码..
function loadTweets(){
var url = 'http://search.twitter.com/search.json?q=blue%20angels&rpp=5&include_entities=true&result_type=mixed&callback=?';
var tweets = $('#twitter');
$.getJSON(url,
function(data){
$.each(data.results, function(i,item){
// parse image url
var imgString = parseImg(item.profile_image_url, item.from_user);
var urlString = parseUrl(item.from_user, item.id);
var tweetString = parseTweet(item.text);
//tweets.append('<div>'+imgString+'<p>'+urlString+'</p>'+'<p>'+tweetString+'</p></div>');
var contentString = '<div>'+imgString+'<p>'+urlString+'</p>'+'<p>'+tweetString+'</p></div>';
console.log(item.location);
});
});
};
返回的 JSON 样本
from_user: "Elvira_Sysyn",
from_user_id: 539551608,
from_user_id_str: "539551608",
from_user_name: "Elvira Sysyn",
geo: null,
location: "San Francisco, CA",
id: 258898154894786560,
id_str: "258898154894786560",
iso_language_code: "en",
metadata: {
result_type: "recent"
},
profile_image_url: "http://a0.twimg.com/profile_images/2519826073/kl_normal.jpg",
profile_image_url_https: "https://si0.twimg.com/profile_images/2519826073/kl_normal.jpg",
source: "<a href="http://twitter.com/">web</a>",
text: "woww!! the big surprise, just 1 days your followers can reach 3000 up, visit ---> http://t.co/UqhRKnKr",
to_user: null,
to_user_id: 0,
to_user_id_str: "0",
to_user_name: null
我真的必须完成这个,我会很感激任何帮助..