Facebook 粉丝页面提要

发布于 2024-10-16 11:40:22 字数 1749 浏览 1 评论 0原文

我想包含一个小部件,用户将在其中添加 facebook 粉丝页面的 url,并且他应该能够从特定页面获取所有提要或最近的提要,并将其显示在像 facebook 粉丝框这样的框中。但应该如此。我该怎么做?我只能对一个特定的 Facebook 页面执行此操作。它应该动态添加。所以每个用户都可以输入不同的 Facebook 粉丝页面链接,他应该能够获取它。

多谢

<!DOCTYPE HTML>

脸书动态

<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>

I want to include a widget where the user will add a url of the facebook fan page and he shoudl be able to get all the feeds or the recent feeds from the particular page and it will displayed in a box like facebook fan box. But it should. How do I do that.I was able to do that for only one particular facebook page. It should be added dynamically. so each user can enter a different facebook fan page link and he should be able to get it.

Thanks alot

<!DOCTYPE HTML>

Facebook feed

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧情别恋 2024-10-23 11:40:22

我得到了这个问题的解决方案,我包括下面的源代码

<html>
<head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

    <script type="text/javascript">



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 facebookname= document.getElementById("fname").value;

 alert("You are searching for: " + facebookname);

var url = "http://graph.facebook.com/" + facebookname + "/feed?limit=5&callback=?";

    //var url = "http://graph.facebook.com/jeevan.dongre/feed?limit=5&callback=?";



    //alert(url);
    //Use jQuery getJSON method to fetch the data from the url and then create our unordered list with the relevant data.
    $.getJSON(url,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>";


    //  $('.facebookfeed').html(html).slideDown(200);
        //A little animation once fetched
        $('.facebookfeed').animate({opacity:0}, 500, function(){

                $('.facebookfeed').html(html);

                                                              });

        $('.facebookfeed').animate({opacity:1}, 500);

    });



};

//onload="fbFetch()"
</script>



</head>
    <body >
    <center><h1>Friend's Page Feed</h1></center>
        <table border=1 width="600px" align="center">
            <tr>
                <td width="200px";>
                    Enter Facebook name here:
                </td>
                <td width="400px;">
                    <input type=text name="fname" id="fname" >
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type=submit value=enter onclick="fbFetch()">
                </td>
            </tr>
            <tr>
                <td colspan="2">

                        <div class="facebookfeed">
                            <h2>Content will load here...</h2>
                        </div>
                </td>
            </tr>
        </table>
    </body>

I got the solution this problem I am including the source code below

<html>
<head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

    <script type="text/javascript">



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 facebookname= document.getElementById("fname").value;

 alert("You are searching for: " + facebookname);

var url = "http://graph.facebook.com/" + facebookname + "/feed?limit=5&callback=?";

    //var url = "http://graph.facebook.com/jeevan.dongre/feed?limit=5&callback=?";



    //alert(url);
    //Use jQuery getJSON method to fetch the data from the url and then create our unordered list with the relevant data.
    $.getJSON(url,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>";


    //  $('.facebookfeed').html(html).slideDown(200);
        //A little animation once fetched
        $('.facebookfeed').animate({opacity:0}, 500, function(){

                $('.facebookfeed').html(html);

                                                              });

        $('.facebookfeed').animate({opacity:1}, 500);

    });



};

//onload="fbFetch()"
</script>



</head>
    <body >
    <center><h1>Friend's Page Feed</h1></center>
        <table border=1 width="600px" align="center">
            <tr>
                <td width="200px";>
                    Enter Facebook name here:
                </td>
                <td width="400px;">
                    <input type=text name="fname" id="fname" >
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type=submit value=enter onclick="fbFetch()">
                </td>
            </tr>
            <tr>
                <td colspan="2">

                        <div class="facebookfeed">
                            <h2>Content will load here...</h2>
                        </div>
                </td>
            </tr>
        </table>
    </body>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文