I have an MVC project I'm working on, and am creating a set of different submit buttons, each which pass a different value to the controller on submission.
In my current code, I have the call to the submit function first create hidden input elements to pass the data I want, something like this:
$('#btnCreate').live('click', function () {
$('#formIndex').submit(function (event) {
$('#actions').append('<input type="hidden" name="objectId" value="' + $('input[name="objectList"]').val() + '" />');
$('#actions').append('<input type="hidden" name="choice" value="create" />');
});
});
I'm wondering if I can just pass the values of those hidden inputs as a set of parameters in the submit call, like you can do with the $.get, $.post, and $.ajax functions. I've experimented but haven't seemed to hit on the right formula yet.
Thanks for your help!