admin管理员组文章数量:1321252
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
1 Answer
Reset to default 6This 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");
});
本文标签: javascriptJQuery Alertify confirm dialog box not working properlyStack Overflow
版权声明:本文标题:javascript - JQuery Alertify confirm dialog box not working properly - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742096402a2420574.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论