im working on a project using mvc asp.net and what i try to do now is to submit a form using javascript.
the javascript works and submit my form.
My problem is that i have a value in my button tag which i want get in my controller but its only null.
the controller is correct because if i do a normal submit without javascript i get the value i want from
my <button>
using javascript i only receive null.
someone can give me a hand with this pls??
thanks in advance
Here is my code:
$(function () {
$('form').find('button[type=submit]').click(function (e) {
e.preventDefault();
$form = $(this).closest('form');
if (this.name == 'yes') {
doConfirm("Confirm that you want to validate?", function yes() {
$form.submit();
});
} else {
doReject("Confirm that you want reject?", function no() {
// do nothing
});
}
});
});