function addUserRole() {
var instance = $('#resourcesTree').jstree(true);
var select = instance.get_checked (true);
var ids = [];
for (var i = 0; i < select.length; i++) {
ids.push('{"id":"' + select[i].id + '"}');
}
debugger;
$.ajax({
type : "post", //提交方式
url : "${ctx}/role/addRoleResources/" + ${roleId},//路径
//dataType : "json",
contentType : "application/json",
data : '[' + ids + ']',
success : function(result) {//返回数据根据结果进行相应的处理
parent.parent.layer.alert('保存成功!', {
icon : 6
});
}
});
}
var instance = $('#resourcesTree').jstree(true);
var select = instance.get_checked (true);
var ids = [];
for (var i = 0; i < select.length; i++) {
ids.push('{"id":"' + select[i].id + '"}');
}
debugger;
$.ajax({
type : "post", //提交方式
url : "${ctx}/role/addRoleResources/" + ${roleId},//路径
//dataType : "json",
contentType : "application/json",
data : '[' + ids + ']',
success : function(result) {//返回数据根据结果进行相应的处理
parent.parent.layer.alert('保存成功!', {
icon : 6
});
}
});
}
本文介绍了一段JavaScript代码,该代码用于实现角色管理中资源权限的分配功能。通过使用jstree插件选择资源节点,并将所选节点的ID以JSON格式发送到服务器端进行保存。实现了动态权限管理。
2万+

被折叠的 条评论
为什么被折叠?



