2017-07-07 42 views
0

我試圖得到Yammer的當前用戶的所有羣體,我用曾嘗試無法從https://www.yammer.com/api/v1/groups.json?mine=1導致

https://www.yammer.com/api/v1/groups.json?mine=1 https://www.yammer.com/api/v1/users/current.json?include_group_memberships=true

我使用下面的代碼

yam.platform.request ({ 
     url : "groups.json?mine=1", 
     method : "GET", 
     data : { }, 
     success : function (group) { 
      alert('hi'); 
      alert(group); 
      $mygroup = ""; 
      for ($i = 0; $i < group.length; $i++) { 
       $mygroup += '<img src="' + group [ $i ].mugshot_url + '">' + " " + group [ $i ].full_name + "," + "<br>"; 
      } 
      $ ("#current-groups").html ($mygroup); 
     }, 
     error : function (group) { 
      alert ("No Go" + group.results); 
     } 
    }); 

我總是得到錯誤。

由於提前

+0

你什麼錯誤? –

回答

1

從我的代碼去除

data : { }, 

後,它開始工作

yam.platform.request ({ 
    url : "groups.json?mine=1", 
    method : "GET", 
    data : { }, 
    success : function (group) { 
     alert('hi'); 
     alert(group); 
     $mygroup = ""; 
     for ($i = 0; $i < group.length; $i++) { 
      $mygroup += '<img src="' + group [ $i ].mugshot_url + '">' + " " + group [ $i ].full_name + "," + "<br>"; 
     } 
     $ ("#current-groups").html ($mygroup); 
    }, 
    error : function (group) { 
     alert ("No Go" + group.results); 
    } 
}); 
相關問題