私はこの Facebook の招待 (apprequest) を行っていますが、ユーザーが行った招待の数を数える必要があります。
以下のコードは機能しますが、ユーザーが送信した招待の数に関係なく、1 つの招待のみをカウントします
<script>
FB.init({
appId:'<?=$myappid?>',
cookie:true,
status:true,
xfbml:true
});
function FacebookInviteFriends()
{//start of FacebookInviteFriends
var inviteCounter = FB.ui({
method: 'apprequests',
message: '<?=$me['name']?> has invited you to play this game!',
title: 'Select your friends to play this game!',
exclude_ids: <?=$allFBStr?>,
max_recipients: 5
},
function (inviteCounter) {
var userID = '<?=$me['id']?>';
//alert(userID);
$.ajax({//ajax
type: 'POST',
url: 'addInvitationCounter.php',
data: {
userID: userID
},
success: function(result){
//alert("SUCCESS: " + result);
location.href = "myprofile.php";
},
error: function(result){
alert("ERROR: " + result);
}
});
}
);
}
</script>