2

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

确认时面临的问题,在确定或取消点击时无法正常工作

示例 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 
           }
});
4

1 回答 1

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");
 });
于 2013-07-17T09:08:43.940 回答