1
我正在使用jQuery檢索和顯示關於json格式的2個足球隊的鳴叫。 我目前正在輸出文字和用戶ID,但我計劃在谷歌地圖上繪製這些推文。但首先我需要獲取推文的位置。關於如何實現這一點的任何想法。如何確定鳴叫的位置(共鳴)
到目前爲止的基本代碼如下;
<script type="text/javascript">
$(document).ready(function(){
var team1, team2;
team1 = '<?php echo $_GET["team1"]; ?>';
team2 = '<?php echo $_GET["team2"]; ?>';
var url1="http://search.twitter.com/search.json?q=%23"+team1+"&callback=?";
var url2="http://search.twitter.com/search.json?q=%23"+team2+"&callback=?";
$.getJSON(
url1,function(results){ // get the tweets
var res1 = results.results[0].text;
var userID1 = results.results[0].from_user_id;
$("#last-tweet1").html(res1 + "<p>user id: " + userID1); // get the first tweet in the response and place it inside the div
});
$.getJSON(
url2,function(results){ // get the tweets
var res2 = results.results[0].text;
var userID2 = results.results[0].from_user_id;
$("#last-tweet2").html(res2 + "<p>user id: " + userID2 + "</p>"); // get the first tweet in the response and place it inside the div
});
嗨亞伯拉罕 - 我可以從json文件中獲取用戶標識 - 是否有可能以某種方式獲取位置? (所以並不是推文發自的地方) – Jono 2011-03-29 08:13:40
實際上,如果我使用地理編碼調用Twitter,我只能返回具有填寫的「地點」(例如曼徹斯特)的結果。現在我所需要的就是以某種方式將它鏈接到Google地圖。 – Jono 2011-03-29 10:09:24