0

I am using the following code to send invitations to my facebook friends but it opens request pop up but no invitations are received to my friends:

<div>
    <div id="fb-root">
    </div>
    <script src="http://connect.facebook.net/en_US/all.js">

if (top.location != self.location) { top.location = self.location }

        FB.init({
            appId: 'my_app_id',
            cookie: true,
            status: true,
            xfbml: true
        });

        function FacebookInviteFriends() {
            FB.ui({
                method: 'apprequests',
                message: '9lessons Programming Blog Topics focused on Web Programming.'
            });
        }
    </script>
    <a href='#' onclick="FacebookInviteFriends();">Facebook Invite Friends</a>
</div>

i am following the This link to to do this.

please help me. please help me find where i am doing wrong. here is the screenshoot of my apps settingsenter image description here

Charles
  • 50,943
  • 13
  • 104
  • 142
Ram Singh
  • 6,664
  • 35
  • 100
  • 166

1 Answers1

0

I have did nothing just "Take my app out of sandbox mode" and upload the page on Live website. It is working fine there. i think facebook was not able to send invitations from localhost. So here is the code i have used to sent invitations from facebook.:

 <div id="fb-root">
</div>
<a href="#" onclick="FbRequest('If you want to fulfill your wishes then do not miss the opertuanty, huury up and join WishIsDone, A platform where you can fulfill your as well as your friends wishes...!','609416079110673');">
    Send Request</a>
<script type="text/javascript">
    function FbRequest(message, data) {
        FB.ui({ method: 'apprequests', message: message, data: data, title: 'Share this site with your friends' },
            function (response) {
                // response.request_ids holds an array of user ids that received the request
                var receiverIDs;
                if (response.request) {
                    var receiverIDs = response.to;  // receiverIDs is an array holding all user ids
                    alert(receiverIDs);
                }
            }
    );
    }
    // typical application initialization code for your site
    (function () {
        var e = document.createElement('script');
        e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
    } ());
    window.fbAsyncInit = function () {
        FB.init({
            appId: 'app_Id',
            session: {},
            status: true,
            cookie: true,
            xfbml: true
        });
    };
</script>

That's all and thanks to all who replied to my question.

Ram Singh
  • 6,664
  • 35
  • 100
  • 166