How to pass list object with ajax request on Asp.net Mvc

Sample controller and action

 [HttpPost]
 public ActionResult UpdateEmployeePerformance(List<ObjectivesList> ObjectivesList, EmployeePerformance Performance)
 {
     return Json("Ok", JsonRequestBehavior.AllowGet);
 }

Sample Ajax request

$.ajax({
	url: "/Custom/UpdateEmployeePerformanceReview",
	type: "POST",
	data: JSON.stringify({ ObjectivesList: updateObjectivesList, EmployeePerformance  : Performance}),
	dataType: "json",
	async: false,
	contentType: "application/json; charset=utf-8",
	beforeSend: function (XMLHttpRequest) {
		XMLHttpRequest.setRequestHeader("Accept", "application/json");
	},
	success: function (data) {
		debugger
	},
	error: function (XMLHttpRequest, textStatus, errorThrown) {
		debugger;
	}
});
Advertisements

#ajax-list-parameters-request, #ajax-request, #asp-net-mvc, #jquery