2010-11-18 29 views
0

我知道這個問題已被問過千次,但我還沒有遇到明確的答案。如何發佈到授權用戶(具有擴展權限)牆 - Facebook的JS SDK +圖形API

使用JS和Graph API,應用程序(外部網站,所以沒有fbml)如何發佈到用戶牆上?

我已經與用戶建立了擴展權限,並且可以使用Facebook示例代碼發佈到牆上,但腳本中的變量不會出現在FB上。

例如:

function publish_test(){ 
    var body = 'Reading Connect JS documentation'; 
FB.api('/me/feed', 'post', { body: body }, function(response) { 
    if (!response || response.error) { 
    alert('Error occured'); 
    } else { 
    alert('Post ID: ' + response); 
    } 
}); 
} 

此訊息給用戶壁,但它不包含體。任何幫助,將不勝感激。

回答

0

我得到這個代碼的工作

function graphStreamPublish(){ var body = document.getElementById("txtTextToPublish").value; FB.api('/me/feed', 'post', { message: body }, function(response) { if (!response || response.error) { alert('Error occured'); } else { alert('Post ID: ' + response.id); } }); }

相關問題