$("#CreateDepartmentForm").submit(function (e) { e.preventDefault();
var modelx = $(this).serialize();
console.log(modelx);
var cars = [
{
"color": "purple",
"type": "minivan",
"registration": "2018-03-03",
"capacity": 7
},
{
"color": "red",
"type": "station wagon",
"registration": "2018-03-03",
"capacity": 20
}];
$.ajax({
type: "POST",
url: "/Department/CreateDepartmentByAjax",
data: modelx "&test=" cars,
success: function (res) {
},
});
public IActionResult CreateDepartmentByAjax(DepartmentVM model,List<cars> test)
{
}
public class cars
{
public string color { get; set; }
public string type { get; set; }
public string registration { get; set; }
public int capacity { get; set; }
}
Visual Studio Debugging Output