我正在使用 Alertify JQuery插件来显示 alert,confirm, dialog
框。
正面临确认问题,无法正常操作或取消点击
JS代码:
function myconfrm() {
var falgset = true;
alertify.confirm("Are you sure to delete this record.", function (e) {
if (e) {
// user clicked "ok"
falgset = false;
}
});
alert(falgset);
return falgset;
}
$("#btn").live('click', function (event) {
if (myconfrm()) {
// my ajax call
}
});
答案 0 :(得分:6)
这就是我解决的问题 的 JS Fiddle DEMO 强>
$("#btn").live("click", function () {
alertify.confirm("Are you sure you want to delete?", function (asc) {
if (asc) {
//ajax call for delete
alertify.success("Record is deleted.");
} else {
alertify.error("You've clicked cancel");
}
}, "Default Value");
});