0

我想知道在我通过 Facebook 的发送对话框发送私人消息后如何获得回复。

例子:

      FB.ui({
          app_id:"XXXXXXXXXXXXXXXXXXXXXXXXX",
          method: 'send',
          name: "Test send message",
          link: 'www.mywebsite.gi',
          to: ID_USER_FB,
          description:'This is a test '

      });
      // here i would a response
      if (response == TRUE) {
         // do this
      } else {
        // do that
      }
4

1 回答 1

1

FB.ui 方法采用两个参数:一个数据对象和一个回调函数,如下所述:FB.ui

回调函数将是这样的:

  function(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
   }

需要注意的重要一点是 FB.ui 方法是异步的,这就是它需要回调方法的原因。

于 2013-11-01T15:28:15.127 回答