[jQuery] Dialog confirmation before submit
I'm using the jquery validation plugin and when all the fields of the
form are correct I want to show a dialog that inform that the data
will be submited, the problem is that the dialog just show for about
1/2 second and the form is submited, how can I do some kind of delay
or pause before submit the form to show the confirmation.
There is my code:
<script type="text/javascript">
$(function() {
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
modal: true,
buttons: {
Ok: function() {
$(this).dialog('close');
}
}
});
$('#create-user').click(function() {
if($("#RegisterForm").valid())
$('#dialog').dialog('open');
});
});
</script>
<button id="create-user" >Create new user</button>
Thanks in advance...