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