ユーザーの Jive SBS 権限グループのリストを取得しようとしています。これは jQuery でどのように行われますか?
1 に答える
3
Jive v3 API を使用すると、これはそれほど難しくありません。最悪の部分は、有効な JSON にするために Jive からの結果をサニタイズする必要があることです。ありがたいことに、Datafilter を使用できます。
// We will use this as our data filter in the AJAX call
sanitizeJiveJsonResponse: function(response){
return response.replace("throw 'allowIllegalResourceCall is false.';", '');
},
// You can get the logged in user id from the __jive variable. Including any sort
// of JS in a Jive widget or tile will cause that code to run from an iframe, so
// we're using window.parent to reference it
var userid = window.parent._jive_current_user.ID;
if(typeof userid == 'undefined'){
// Error stuff here
}
$.ajax({
url: '/api/core/v3/people/' + userid + '/securityGroups',
context: document.body,
dataType: 'json',
dataFilter: function (data, type) {
return sanitizeJiveJsonResponse(data);
}
}).done(function(result) {
// Your success code here...
});
};
お役に立てれば!
于 2015-08-03T15:00:50.497 に答える