2012-07-24 16 views
2

當我嘗試使用JS FB.api([...]執行操作時,我得到No callback passed to the ApiClient [...] 在哪裏可以設置此回調?沒有回傳給ApiClient

+0

的 'ApiClient'?回調通常不是直接在FB.api()或FB.ui() – Igy 2012-07-24 14:04:45

+0

)調用中定義的。我只需在FB.api()調用中添加一個函數 – heysamhey 2012-07-24 14:35:20

+0

您應該添加該函數作爲答案並接受它,然後 – Igy 2012-07-24 14:52:39

回答

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) 
      } 
     } 
    );