没有回调传递给ApiClient

hey*_*hey 2 javascript api facebook-opengraph

当我尝试用JS执行一个动作时FB.api([...],我得到了No callback passed to the ApiClient [...] 哪里可以设置这个回调?

hey*_*hey 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)
            }
         }
    );
Run Code Online (Sandbox Code Playgroud)