views:

651

answers:

2

I'm trying to integrate Facebook connect to my website. The login button appears and i'm able to login. The profile picture and the name is displayed properly. However when I try adding the code FB.Connect.ifUserConnected, I get a error message saying FB.Connect is not defined.

This is what I'm doing

<div id="fb-root">
</div>
<script src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt;
<script type="text/javascript">
    FB.init({ appId: 'my app id', status: true, cookie: true, xfbml: true });
</script>

<fb:login-button onlogin="fb_login()"></fb:login-button>

<script>
function fb_login() {
    $("#SocialConnectButtons").hide();
    $("#UserProfile").show();
    FB.XFBML.Host.parseDomTree();
}
//ALL UNTIL HERE WORKS AS EXPECTED, BUT THE FOLLOWING LINE FAILS
FB.Connect.ifUserConnected(fb_login);
</script>

Thanks for the help

+2  A: 

Here is a good tutorial to get started with new API for facebook connect.

Sarfraz
Thanks Sarfraz, but doesn't answer my question
Arun
A: 

You are using the new Graph API (http://connect.facebook.net/en_US/all.js)

The code you wrote will not work. Check the Graph API javascript SDK here: http://developers.facebook.com/docs/reference/javascript/

and for the API itself: http://developers.facebook.com/docs/reference/api/

sabbour

related questions