0
我想要包含一個小部件,用戶將在其中添加Facebook粉絲頁面的網址,並且他應該能夠從特定頁面獲取所有提要或最近的提要,並將它顯示在一個框中像Facebook粉絲箱。但它應該。我該怎麼做,我只能爲一個特定的臉書頁面做到這一點。它應該動態添加。所以每個用戶可以輸入不同的Facebook粉絲頁面鏈接,他應該能夠得到它。Facebook粉絲頁面提要
非常感謝
<!DOCTYPE HTML>
Facebook的飼料
<script src="jquery.ui.core.js"></script>
<script src="jquery.ui.widget.js"></script>
<script type="text/javascript">
$(document).ready(function(){
function fbFetch(){
//Set Url of JSON data from the facebook graph api. make sure callback is set with a '?' to overcome the cross domain problems with JSON
var Baseurl = "http://graph.facebook.com/";
var search= $("fburl").val();
//Use jQuery getJSON method to fetch the data from the url and then create our unordered list with the relevant data.
$.getJSON(Baseurl + search + "feed?limit=5&callback=?",function(json){
var html = "<ul>";
//loop through and within data array's retrieve the message variable.
$.each(json.data,function(i,fb){
html += "<li>" + fb.message + "</li>";
});
html += "</ul>";
//A little animation once fetched
$('.facebookfeed').animate({opacity:0}, 500, function(){
$('.facebookfeed').html(html);
});
$('.facebookfeed').animate({opacity:1}, 500);
});
});
});
</script>
</head>
<body>
<input type="text" value="facebookurl" name="facebook_feeds" id="fburl"/>
<input type="submit" id="submit" />
<div class="facebookfeed">
</div>
</body>
</html>
你不能只是添加一個文本字段並獲取它的.val()並將其作爲變量插入到Facebook API中? – benhowdle89 2011-02-09 11:48:31
`$(「#submit」)。click(function(event){//將它作爲一個onclick事件連接到提交按鈕 \t \t \t var searchTerm = $(「#search」)。val(); //獲取用戶輸入的搜索詞 \t \t \t VAR的baseUrl = 「http://graph.facebook.com/」; \t \t \t $ .getJSON(+的baseUrl +搜索關鍵詞「/供給限制= 5&回調=? 「,函數(數據)` – 2011-02-09 11:55:30