JQuery Alertify确认对话框无法正常工作

时间:2013-07-13 11:35:30

标签: javascript jquery alert alertify

我正在使用 Alertify JQuery插件来显示 alert,confirm, dialog 框。

正面临确认问题,无法正常操作或取消点击

Sample JS FIDDLE

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 
           }
});

1 个答案:

答案 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");
 });