On my page I have a section like this:
using (Html.BeginForm("AddSubTor", "Maintor", FormMethod.Post, htmlAttributes: new { ID = "frmSubTors" }))
{
@Html.AntiForgeryToken()
@Html.Partial("_SublistPartial")
<div class="row" style="margin-top: 15px;">
<div class="col-sm-12 col-md-12 col-lg-12 text-center ">
@* submit button here *@
<input type="submit" class="btn btn-default" value="Add" />
</div>
</div>
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
}
Instead of using the submit button, I would replace it then with an image that looks like a button, could I also do the same submit in a jquery function. Like in the click event of that button-like image? Would the data I'm submitting still be submitted?
The reason I want to do this is that in the partial I have two radio buttons. On both I have some Jquery code for retrieving data and other stuff.
If I use a simple submit button I can set the radiobuttons but there is no click event thus the data is not retrieved and other stuff is not done. So if I can use Jquery, then I can simple call the functions that the radiobutton-click events call and so get my data.
[edit] I'm kind of looking for something like this:
$.Ajax({
url: 'controller/action',
type: 'POST',
success: function(data) {
$('#frmSubTors').html(data);
}
}).done(function() {
// do my other stuff here
});
Would this work too?