No, you can't do like this. You have to call another function inside the "buttons".
See my past answer -
jqueryUI dialog returning bool[
^].
$('#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");
}
}
So, here inside
callback
function, you can do what you want.