I changed your action signature to this
public ActionResult Create(EmployeeDAL OBJ, string Details, List<string> Details2)
because "Details" is a single string rather than an array.
You need to create a single JSON object with a property that maps to each of your param values so;
{
"OBJ": {"ID":123, "EmployeeName":"John", ...},
"Details": "Asif",
"Details2": ["Saab", "Volvo", "BMW"]
}
The tricky bit is getting the form data as a JSON object but the getFormData function below does that, and the other params can be added simply
function getFormData($form) {
var unindexed_array = $form.serializeArray();
var indexed_array = {};
$.map(unindexed_array, function (n, i) {
indexed_array[n['name']] = n['value'];
});
return indexed_array;
}
$("#formID").on("submit", function (event) {
event.preventDefault();
var $this = $(this);
var Details2 = ["Saab", "Volvo", "BMW"];
var Details = "Asif";
var allData = {
"OBJ": getFormData($this),
"Details": Details,
"Details2": Details2
};
var json = JSON.stringify(allData);
$.ajax({
cache: false,
async: true,
type: "POST",
url: "@Url.Action("Create", "Employee")",
data: json,
contentType: "application/json; charset=utf-8",
dataType: "json",
traditional: true,
success: function (data) {
alert(data);
}
});
});