我正在尝试从我的 javascript 中的 REST 调用返回的 json 结果中获取值。下面是 REST 的 JSON 结果
{
"self": "http://example.com/rest/api/2/project/MTS/role/10002",
"name": "Administrators",
"id": 10002,
"description": "A project role that represents administrators in a project",
"actors": [{
"id": 10803,
"displayName": "Administrator ",
"type": "atlassian-user-role-actor",
"name": "admin",
"avatarUrl": "/secure/useravatar?size=small&avatarId=10108"
}, {
"id": 10590,
"displayName": "jira-administrators",
"type": "atlassian-group-role-actor",
"name": "jira-administrators",
"avatarUrl": "/secure/useravatar?size=small&avatarId=10123"
}]
}
从这个结果中,我只需要获取所有演员的名字可以有人帮我下面的脚本吗
function getName()
{
var user;
$.ajax({
url: "/rest/api/2/project/MITS/role/10002",
type: 'get',
dataType: 'json',
async: false,
success: function(data) {
user = data;
}
});
return user;
}
上面的脚本不正确请帮忙