In my project I have multiple forms on same page which I want to pass in one go to controller. How to achieve that?
<script>
function onSaveButtonClicked() {
var form = $("#SaveForm").serialize();
var form2 = $("#SaveForm").serialize();
$.ajax({
url: '@Url.Action("Filter","SearcherEngine")',
type: 'post',
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify({ model: form, model2: form2 }),
cache: false,
success: function (result) {
alert(result);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(thrownError);
}
});
};
[HttpPost]
public ActionResult Filter(MyViewMOdel model,MyViewModel2 model2)
{
}