I have a simple form:
<form id="cancel" method="post" action="/Controller/Cancel">
<input class="submitbtn" type="submit" value="Go">
...
I'm using jQuery with a jQuery UI dialog. What I'd like to do is hijack the submit of the form and display a dialog. When the user clicks 'yes' in the dialog, the form carries on and does a normal page submit. If they click 'No', the dialog just cancels.
I have this code:
$(document).ready(function () {
$("#dialog").dialog({
resizable: false,
autoOpen: false,
modal: true,
buttons: {
"Yes": function () {
// Not sure what to do here
$(this).dialog("close");
},
"No": function () {
$(this).dialog("close");
}
}
});
$('#cancel').submit(function (event) {
event.preventDefault();
$('#dialog').dialog('open');
});
});
My question is, how do I get the submit code to return true/false to the client based on the response from the dialog.
Any help appreciated.