没有回调传递给ApiClient

时间:2012-07-24 13:47:55

标签: javascript api facebook-opengraph

当我尝试使用JS FB.api([...]执行操作时,我得到No callback passed to the ApiClient [...] 我在哪里可以设置此回调?

1 个答案:

答案 0 :(得分:5)

只需在API调用中添加回调函数:

    FB.api(
        '/me/[YOUR_APP_NAMESPACE]:[YOUR_ACTION]',
        'post',
        { recipe: '[LINK_TO_YOUR_OBJECT]' },
        function(response) {
            if (!response || response.error) {
                alert('Error occured');
            } 
            else {
                alert('Action was successful! Action ID: ' + response.id)
            }
         }
    );