创建公共调用 jQuery Ajax 带返回值
代码如下:
<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>
相关推荐
83510998 2020-07-18
TONIYH 2020-07-22
wcqwcq 2020-06-26
delmarks 2020-06-14
ppsurcao 2020-06-14
tthappyer 2020-06-07
kentrl 2020-11-10
结束数据方法的参数,该如何定义?-- 集合为自定义实体类中的结合属性,有几个实体类,改变下标就行了。<input id="add" type="button" value="新增visitor&quo
ajaxyan 2020-11-09
zndy0 2020-11-03
学留痕 2020-09-20
Richardxx 2020-11-09
learningever 2020-09-19
chongxiaocheng 2020-08-16
ajaxhe 2020-08-16
lyqdanang 2020-08-16
curiousL 2020-08-03