How to check if user has liked facebook fanpage.

How to check if user has liked facebook fanpage.

<!DOCTYPE HTML>
<html>
<head>
    <title>check facebook fanpage status | fatalWeb.com</title>
</head>
<body>
<script>
$(document).ready(function(){
    FB.getLoginStatus(function(response) {
      if (response.status === 'connected') {
          var user_id = response.authResponse.userID;
          var page_id = "112312825528975"; //https://www.facebook.com/fatalweb.com
          var fql_query = "SELECT uid FROM page_fan WHERE page_id = "+page_id+"and uid="+user_id;
          var the_query = FB.Data.query(fql_query);
          the_query.wait(function(rows) {
              if (rows.length == 1 && rows[0].uid == user_id) {
                  alert("Liked"); //i liked fatalweb
              }
          });
      }
    });

});
</script>
    <div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({
    appId  : '195174700538696',
    status : true, 
    cookie : true, 
    xfbml  : true  
  });
</script>
</body>
</html>

Tags:

Submit an Idea
  Thank you for your valuable feedback.
Your E-mail (optional):
Select Option:
Description:
 
Post a comment
Add a Comments

Log in or create an account to post a comment.

Comment
  Saving...
Feedback
Your Name / email address
Feedback as
Your feedback
close
Quickly sign in with:

Create a FATALWEB account here:

First name:

Last name:

E-mail address:

Join Fatalweb

Already have a fatalweb account? Log in here