++复制代码++ 代码如下:
<script type="text/javascript">
/* 请求Ajax 带返回值,并弹出提示框提醒
--------------------------------------------------*/
function getAjax(url, parm, callBack) {
$.ajax({
type: 'post',
dataType: "text",
url: url,
data: parm,
cache: false,
async: false,
success: function (msg) {
callBack(msg);
}
});
}
/*删除
/*url: 表示请求路径
--------------------------------------------------*/
function DeleteData(url, id) {
var parm = 'active=Del&id=' + id;
if (id == undefined || id == "") {
showAlertMsg('请选择要删除一行');
} else {
showConfirmMsg("此操作不可恢复,确定要删除吗?", function (r) {
if (r) {
getAjax(url, parm, function (rs) {
if (parseInt(rs) > 0) {
showOverAlertMsg("删除成功!", 2000, 4);
} else if (parseInt(rs) == 0) {
showOverAlertMsg("该数据被关联,无法删除!", 2000, 3);
}
else {
showOverAlertMsg("删除失败!", 2000, 5);
}
});
}
});
}
}
先看式如何调用
//删除
function DeleteOnclick() {
DeleteData('SysMenu_List.aspx', Menu_Id);
}
</script>