【技巧】处理提交数据的技巧

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
});
}
});
}
posted @ 2017-08-19 10:27  Legolas_4  阅读(181)  评论(0)    收藏  举报