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