我知道如何通过ajax将视图中的模型传递给控制器 "数据:$(_ form).serialize()"但是如何同时包含一个未绑定的值并将模型和这个额外的参数传递到一起?
// Jquery
$.ajax({
type: "POST",
data: $(_form).serialize(),
});
// Controller
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult PostReservBooking(ReservFile model)
{
.......
}
// Razor View
@model ReservFile
@using (Html.BeginForm("", "", FormMethod.Post, new { @id = "formRowDetails" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.IdNo)
//Here are the components bound to model
........
........
// This is the unbound component
@Html.TextBox("param1", new { @class = "form-control" })
}