0

내 var를 추가하려고 할 때마다 postToFeed 함수가 실행되지 않아 며칠 동안 아무런 도움이되지 않을 것입니다!Javascript var에 피드가없는 페이 스북 포스트가로드되고 있습니다

FB.init :

<div id='fb-root'></div> 
    <script src='http://connect.facebook.net/en_US/all.js'></script> 
    <p><a onclick='postToFeed(); return false;'>Post to Feed</a></p> 
    <p id='msg'></p> 

    <script> 
     FB.init({appId: "XXXXXXXXXXXX", status: true, cookie: true}); 

     function postToFeed() { 

     // calling the API ... 
     var obj = { 
      method: 'feed', 
      link: 'https://google.com', 
      picture: 'http://google.com/logo.png', 
      name: 'gamehighscore', 
      caption: 'I just got a highscore of'+record+'', 
      description: 'Try to beat my score!.' 
     }; 

     function callback(response) { 
      document.getElementById('msg').innerHTML = "Post ID: " + response['post_id']; 
     } 

     FB.ui(obj, callback); 
     } 

    </script> 

답변

0

나는이고, 생각 ({APPID "XXXXXXXXXXXX", 상태 : 사실, 쿠키는 true});

FB 자바 스크립트 API가로드되지 않았습니다. 이 방법으로 자바 스크립트 API를로드해야합니다

window.fbAsyncInit = function() { 
    FB.init({ 
     appId: 'XXXXXXXXXX', 
     status: true, 
     cookie: true, 
     xfbml: true 
    }); 

또는이 방법 : 내가 변수 레코드를 추가 할 때 스크립트가 잘 작동

<div id="fb-root"></div> 
<script>(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/all.js#xfbml=1&appId=XXXXXXXX"; 
    fjs.parentNode.insertBefore(js, fjs); 
}(document, 'script', 'facebook-jssdk'));</script> 
+0

그것이 내가 게시 거기에 내가 단지 XXXXXX를 응용 프로그램 IP를 hadd 실패합니다. – Kenp

+0

이 작동하지 않습니다 – Kenp

+0

어떤 스크립트가 작동하지 않습니까? [app의 패널] (https://developers.facebook.com/apps)에 올바른 값을 쓰고 있습니까? – neworld