Publish to Current user's wall using FBJS in FBML application

Posted by Damodaran on Stack Overflow See other posts from Stack Overflow or by Damodaran
Published on 2011-01-13T09:52:07Z Indexed on 2011/01/13 9:53 UTC
Read the original article Hit count: 264

Filed under:
|
|

Hi

I need to publish some message to the current user's wall using FBJS in FBML application. When I use

window.fbAsyncInit = function() {
    FB.init({appId: 'MY_APP_ID', status: true, cookie: true, xfbml: false});
};

i am getting an error :- FB is not defined. and window is not defined. For publishing i am using this code

function graphStreamPublish(){
           var body = document.getElementById("txtTextToPublish").value;
            FB.api('/me/feed', 'post', { message: body }, function(response) {
                if (!response || response.error) {
                    // alert('Error occured');
                } else {
                    // alert('Post ID: ' + response.id);
                }
           });
     }

(I cannot use alert in facebook..)

Thanks in advance..

© Stack Overflow or respective owner

Related posts about facebook

Related posts about fbml