http://blog.csdn.net/qq_26553781/article/details/78058389
-----------------------------------------------------------------------------------
//删除-单条
function dele(id) {
layer.confirm('您确认删除选中记录?', {
btn : [ '删除' ]
//按钮
}, function() {
deleteDeployById(id);
});
}
//批量删除
$('#remove').click(function() {
deleteDeploy();
});
function deleteDeploy() {
var rows = $('#cusTable').bootstrapTable('getSelections');
var ids="";
for(var i=0;i<rows.length;i++){
ids+=rows[i]['id']+",";
}
ids=ids.substring(0,ids.length-1);
alert(ids+"-----ids-------");
if (rows.length > 0) {
layer.confirm('您确认删除选中记录?', {
btn : [ '删除' ]
//按钮
}, function(){
deleteDeployById(ids);
});
} else {
layer.msg("请选择删除项", {
icon : 2
});
return;
}
}
//执行删除操作
function deleteDeployById(ids) {
$.ajax({
url : 'deleteUserDeploy.json',
data:'ids=' + ids,
type : 'post',
success : function(data, textStatus, jqXHR) {
layer.msg('删除成功', {
icon : 1
});
$('#cusTable').bootstrapTable('refresh');
},
error : function(jqXHR, textStatus, errorThrown) {
layer.msg(textStatus, {
icon : 2
});
}
});
}