我想繪製一個谷歌地圖的推文,但位置總是未定義的,一切工作正常,如果我使用一個實際的位置字符串,再次罰款。我檢查了JSON並指定了位置。推特地點undefined
有人知道我做錯了什麼?
我的代碼..
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
我真的得到這個完了,我想感謝所有幫助..
是從具有的getJSON只locaton控制檯數據對象和看到 – fuzionpro
不,它不是數據對象:「(感謝 – user1756180