2012-08-02 98 views
1

我正在一個網站上工作,作爲我們允許用戶邀請他們的朋友的一部分。使用以下代碼Facebook API:發送消息給朋友只適用於測試/管理用戶

// assume we are already logged in 
    FB.init({appId: 'xxxxxxxx49030', xfbml: true, cookie: true}); 
    function sendInvites(fb_ids) { 
       var link_url = "<?php echo base_url()?>invited/?code=100627510332492694"; 
       FB.ui({ 
        method: "send", 
        to: fb_ids, 
        name: "Join example.com", 
        description: "hello", 
        picture: "http://www.example.com/images/logo-orange.png", 
        link: link_url 
       }, function(response) { 
        alert(response) 
        if (!response){ 

         return; 
        } 

        $.post("/invite/new/", { 
         fb_ids: fb_ids 
        }, function(data) { 
         if (data.status == "success") { 
          alert(data.status); 
         } else { 
          alert(data.message); 
         } 
        }, "json"); 
       }); 
      } 

不明白缺少什麼。

回答

0

Fbids應該是一個數組,我錯過了它。現在正在工作。

相關問題