In the following form when I hit submit, it alerts 111
, but does not send an ajax request. It instead sends a page-refreshing submit request. Why?
<form id="post_answer_form" method="POST" action="some_url">
<fieldset>
<textarea id="qanswer" name="qanswer"></textarea>
<button type="submit">Post Your Answer </button>
<button type="submit" style="display: none;">Update </button>
</fieldset>
</form>
I'm validating it against some rules as follows:
$(document).on('submit', '#post_answer_form', function(){
alert(111)
tinymce.triggerSave();
}).validate({
ignore: '',
rules: {
qanswer: {
required: true,
}
},
submitHandler: function(form) {
alert(111)
$.ajax({
...
});
return false
},
});