最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JQuery Alertify confirm dialog box not working properly - Stack Overflow

programmeradmin4浏览0评论

I am using Alertify JQuery Plugin, to display alert,confirm, dialog box.

Problem am facing for confirmation, it not work correctly on ok or cancel click

Sample JS FIDDLE

JS Code:

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

I am using Alertify JQuery Plugin, to display alert,confirm, dialog box.

Problem am facing for confirmation, it not work correctly on ok or cancel click

Sample JS FIDDLE

JS Code:

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 
           }
});
Share Improve this question edited Jan 25, 2014 at 11:41 ArK 21.1k67 gold badges111 silver badges136 bronze badges asked Jul 13, 2013 at 11:35 Satinder singhSatinder singh 10.2k18 gold badges64 silver badges102 bronze badges 4
  • Just wondering: I noticed that your Alertify (the word at the top) looks cool. How do you do that? – Jean-Paul Commented Jul 13, 2013 at 11:43
  • 2 @Jean-Paul: i used kbd tag for that effect, – Satinder singh Commented Jul 13, 2013 at 11:53
  • @Homam: i have updated my question with JS fiddledemo – Satinder singh Commented Jul 13, 2013 at 12:09
  • @downvoter: can you tell me, why u downvote, cmt pls – Satinder singh Commented Jul 13, 2013 at 12:49
Add a ment  | 

1 Answer 1

Reset to default 6

This is how i solved
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");
 });
发布评论

评论列表(0)

  1. 暂无评论