jquery - Facebook fan page feeds -
i want include widget user add url of facebook fan page , shoudl able feeds or recent feeds particular page , displayed in box facebook fan box. should. how do that.i able 1 particular facebook page. should added dynamically. each user can enter different facebook fan page link , should able 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 facebook graph api. make sure callback set '?' overcome cross domain problems json var baseurl = "http://graph.facebook.com/"; var search= $("fburl").val(); //use jquery getjson method fetch data url , create our unordered list relevant data. $.getjson(baseurl + search + "feed?limit=5&callback=?",function(json){ var html = "<ul>"; //loop through , within data array's retrieve 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 got solution problem including 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 facebook graph api. make sure callback set '?' overcome cross domain problems json var facebookname= document.getelementbyid("fname").value; alert("you 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 fetch data url , create our unordered list relevant data. $.getjson(url,function(json){ var html = "<ul>"; //loop through , within data array's retrieve 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 load here...</h2> </div> </td> </tr> </table> </body>
Comments
Post a Comment