0

教程的代码是:

  <script type="text/javascript">
  function postCook()
  {
      FB.api(
        '/me/[YOUR_APP_NAMESPACE]:cook?recipe=http://fbwerks.com:8000/zhen/cookie.html',
        'post',
        function(response) {
           if (!response || response.error) {
              alert('Error occured');
           } else {
              alert('Cook was successful! Action ID: ' + response.id);
           }
        });
  }
  </script>

我需要以相同的方式创建一个按钮,但要删除时间线的选项。谢谢你。

4

1 回答 1

1

请记住,这只有在您拥有要删除的项目的操作 ID 时才有效。因此,如果您按如下所示设置按钮,则可以使用:

//Button code
<button onclick="deleteCook(ActionID)">Delete Cook </button>

 <script type="text/javascript">   
function deleteCook(ActionID) {



            FB.api(ActionID, 'delete', function(response) {
              if (!response || response.error) {
                alert('Error occured');

              } else {
                 alert('Cook action was deleted');
                          }
            });

                                               });
           }
</script>
于 2012-05-06T07:33:01.587 回答