Facebook Invite Function
The Invite function for the Facebook or Facebook Invitation is easy and simple. Just use following javascript.
The below function is for Multiple Facebook Friend Invite
The below function is for Single Facebook Friend Invite
The below function is for callback function when user perform the action
Anchor for the single user Facebook invitation :
Anchor for the multiple user Facebook invitation :
I think, this is clear and simple. Just use it code and invite facebook friend for your website.
<script type="text/javascript">
<!-- for facebook invite-->
var message='/*Message displayed in the top of the invite window*/';
The below function is for Multiple Facebook Friend Invite
function MultiFriendSelector() {
FB.ui({method: 'apprequests',
title: '/*Title of the app*/',
message: message,
}, requestCallback);
}
The below function is for Single Facebook Friend Invite
function FacebookInviteFriends(id)
{
FB.ui({method: 'apprequests',
title: '/*Title of the app*/',
message: message,
to: id,
}, requestCallback);
}
The below function is for callback function when user perform the action
function requestCallback(response) {
if (response.request && response.to) {
var request_ids = [];
for(i=0; i<response.to.length; i++) {
var temp = response.to[i];
request_ids.push(temp);
}
var requests = request_ids.join(',');
$.post('/*function to store the data*/',{
uid: /*Logged in user id*/,
request_ids: requests},function(resp) {
});
}
return false;
}
</script>
Anchor for the single user Facebook invitation :
<a href="#" onClick="FacebookInviteFriends(/*facebook user id*/);"
title="Invite this person">Invite</a>
Anchor for the multiple user Facebook invitation :
<a href="#" onclick="MultiFriendSelector()">Invite your Facebook friends!</a>
I think, this is clear and simple. Just use it code and invite facebook friend for your website.
Comments
Post a Comment