how can I check which submit button was pressed?
I have a two submit buttons set up for form submission. I'd like to know
which submit button was clicked without applying a .click() event to each
one. One more thing I am using ASP.NET MVC 3 and want to get the clicked
button name in Controller.
Here's the setup:
<a class="anchorbutton">
<input type="submit" value="Save" id="Save" class="hrbutton"/>
</a>
<input type="submit" value="Save & Next" id="SaveNext" class="hrbutton
anchorbutton"/>
$('#form').live('submit', function (e)
{
e.preventDefault();
var form = $('#form');
$.ajax({
cache: false,
async: true,
type: "POST",
url: form.attr('action'),
data: form.serialize(),
success: function (data) {
$.ajax({
url: 'url',
dataType: "html",
success: function (data) {
$("#div").html(data);
}
});
}
});
return false;
});
[HttpPost]
public JsonResult Post(FormCollection form, string submitButton)
{
}
No comments:
Post a Comment