2012-02-28 3 views
-1

私はこの例を動作させようとしていますが、使用方法はわかりません。 コピーして貼り付けるだけでは、コード自体は機能しません。何かが不足していることを理解していますが、何ですか?fbrell.comのサンプルを入手するには?

コードがここに発見された:のみ

http://www.fbrell.com/fb.ui/apprequests?autoRun=false

+0

FB.uiを呼び出す前に、あなたがロードやFacebookのJavaScript SDKを初期化する必要があります。問題がある場合は、https://developers.facebook.com/docs/reference/javascript/を参照してください。 –

+0

私はそれを試みたが、それでも動作しません。完全なコードはどのように見えますか? –

答えて

4

最初の例は:

<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> 
関連する問題