I did that using JS
window.fbAsyncInit = function () { FB.init({ appId: apiKeyofYourApp, status: true, cookie: true, xfbml: true }); };
(function () {
var e = document.createElement('script'); e.async = false;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
var dv = document.createElement('div');
dv.id = "fb-root";
document.body.appendChild(dv);
document.getElementById('fb-root').appendChild(e);
var fbLoader = document.createElement('div');
fbLoader.id = "fbLoader";
document.body.appendChild(fbLoader);
var fbFade = document.createElement('div');
fbFade.id = "fbfade";
document.body.appendChild(fbFade);
} ());
function fbinvitelogin() {
FB.login(function (response) {
inviteFriends('dvFBContacts');
}, { perms: accessParameters });
}
function inviteFriends(contDiv) {
FB.getLoginStatus(function (response) {
if (response.session) {
$('#dvFBNonLoggedIn').fadeOut('slow');
$('#dvFBLoggedIn').fadeIn('slow');
$('#dvWait').fadeOut('slow');
getAlreadyUsingFBIds(contDiv);
} else {
$('#dvFBNonLoggedIn').fadeIn('slow');
$('#dvFBLoggedIn').fadeOut('slow');
$('#dvWait').fadeOut('slow');
}
});
}