;
var account_index_ops = {
init: function () {
this.eventBind();
},
eventBind: function () {
var that = this;
$("#remove").click(function () {
that.ops("#remove", $(this).attr("data"));
if (!confirm("是否确认删除?")) {
return false
}
window.location.reload()
});
},
ops:function (act, id){
$.ajax({
url: common_ops.buildUrl("/account/ops"),
type: 'POST',
data: {
act: act,
id: id
},
dataType: 'json',
success: function (res) {
btn_target.removeClass("disabled");
alert(res.msg);
if (res.code == 200) {
window.location.href = window.location.href;
}
}
});
}
};
老师我是通过ajax请求来删除列表页中的数据
问题:我用的是系统的对话框来删除的,代码如下
if (!confirm("是否确认删除?")) {
return false
}
实际上我想用自己做好的模态框来请求服务端删除数据
var account_index_ops = {
init: function () {
this.eventBind();
},
eventBind: function () {
$("#save").click(function () {
var btn_target = $(this);
if (btn_target.hasClass("disabled")) {
alert("正在处理!!!请不要重复点击");
return;
}
btn_target.addClass("disabled");
});
var data = {
id:id,
};
$.ajax({
url: common_ops.buildUrl("/account/ops"),
type: 'POST',
data: data,
dataType: 'json',
success: function (res) {
btn_target.removeClass("disabled");
alert(res.msg);
if (res.code == 200) {
window.location.href = common_ops.buildUrl("/account/index");
}
}
});
},
};