-1
我想讓這個例子工作,但我不知道如何使用它。 如果我只複製並粘貼,代碼本身不起作用。我明白缺少某些東西,但是什麼?在fbrell.com上獲取示例以運行?
代碼是在這裏找到:
http://www.fbrell.com/fb.ui/apprequests?autoRun=false
我想讓這個例子工作,但我不知道如何使用它。 如果我只複製並粘貼,代碼本身不起作用。我明白缺少某些東西,但是什麼?在fbrell.com上獲取示例以運行?
代碼是在這裏找到:
http://www.fbrell.com/fb.ui/apprequests?autoRun=false
首隻例如:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<APP_ID>',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
<h1>requests</h1>
<button id="send-to-many">Send to Many</button>
<script>
document.getElementById('send-to-many').onclick = function() {
FB.ui({
method: 'apprequests',
message: 'You should learn more about the Platform.'
}, function(response) {
console.log(response);
});
}
</script>
在致電FB.ui你必須加載和初始化的Facebook的JavaScript SDK。如果您遇到任何困難,請參閱https://developers.facebook.com/docs/reference/javascript/併發帖。 – 2012-02-28 11:17:17
我嘗試過,但仍然無法使用。完整的代碼應該是什麼樣子? – 2012-02-28 11:20:46