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