0
,我有以下的js代碼,但它不工作,我已經tryed太多,但沒有成功: •我已經有一個非完全失效的訪問令牌 •我都permisions邀請朋友試用Facebook應用程序無法正常工作
<html>
<head>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<title>Invite</title>
</head>
<body>
<A href="#" onMouseOver="return changeImage()" ><img
name="jsbutton" src="http://cdn.property118.com/wp-content/uploads/2014/06 /Invite- friends-to-read-Property118-.jpeg" width="110" height="28" border="0"
alt="javascript button"></A>
<SCRIPT language="JavaScript">
window.fbAsyncInit = function() {
FB.init({ appId: xxxxxxxx,
status: true,
cookie: true,
xfbml: true,
oauth: true
version : 'v2.1'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
function renderMFS() {
// First get the list of friends for this user with the Graph API
FB.api('/me/invitable_friends?limit=3000&access_token="I already have a non expire full user access token",
function(response) {
var container = document.getElementById('mfs');
var mfsForm = document.createElement('form');
mfsForm.id = 'mfsForm';
// Iterate through the array of friends object and create a checkbox for each one.
for(var i = 0; i < Math.min(response.data.length, 10); i++) {
var friendItem = document.createElement('div');
friendItem.id = 'friend_' + response.data[i].id;
friendItem.innerHTML = '<input type="checkbox" name="friends" value="'
+ response.data[i].id
+ '" />' + response.data[i].name;
mfsForm.appendChild(friendItem);
}
container.appendChild(mfsForm);
// Create a button to send the Request(s)
var sendButton = document.createElement('input');
sendButton.type = 'button';
sendButton.value = 'Send Request';
sendButton.onclick = sendRequest;
mfsForm.appendChild(sendButton);
});
}
}
});
</SCRIPT>
<div id="fb-root"></div>
</body>
</html>
我希望我的代碼顯示這樣的事情Example但是當我點擊該鈕沒有任何反應。在此先感謝
感謝,我的錯誤了一些東西,我的更新代碼,但它仍不能在這裏工作是新的[代碼] (http://herbalista.hol.es/invite.html)。對不起,我是新的FB JS SDK,我正在使用圖形api谷歌應用程序腳本和它的好...我正在與這[指導](https://developers.facebook.com/docs/games /multi-friend-selector/v2.2) –
「TypeError:response.data未定義」 - 您需要單獨調試「響應」。 – luschn