Problem
JavaScript
is
Asynchronous
.
Solution
In order to get the values, you have to call one
CallBack
function.
So, modify your Code like below.
$('#id').dialog({
autoOpen: false,
width: 600,
modal: true,
buttons: {
"Yes": function () {
$(this).dialog('close');
callback(true);
},
"No": function () {
$(this).dialog('close');
callback(false);
}
}
});
function callback(value) {
if (value) {
alert("Confirmed");
} else {
alert("Rejected");
}
}
Demo
[Demo] jQuery UI Confirm Dialog Box[
^]