以下の jQuery UI ダイアログフォームで、「OK」または「キャンセル」がクリックされたかどうかを「閉じる」コールバック関数内で追跡するにはどうすればよいですか?
$( "#dialog-form" ).dialog( "option", "buttons",
[
{
text: "OK",
click: function() {
// sone action...
$( this ).dialog( "close" );
}
},
{
text: "Cancel",
click: function() {
$( this ).dialog( "close" );
}
}
]
);
$( "#dialog-form" ).dialog({
close: function(event, ui) {
// Track here whether 'OK' or 'Cancel' was clicked...
}
});