I'm trying to pass json data from view to controller but controller getting null all the time I tried every thing to resolve this issue but didn't find any solution here is my controller and json data
$("#ex_save").on("click",function() {
var array = @Html.Raw(Json.Encode(Model));
var json = JSON.stringify(array);
$.ajax({
type: "POST",
url: "/Equipment/BulkUpdate",
data: { jsonCollection : json },
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function () {
console.log("Saved");
},
error: function (e) {
console.log(e);
}
});
});
this my ajax method to pass data to controller. and here is my controller to get that data :-
[HttpPost]
public ActionResult BulkUpdate(string jsonCollection)
{
try
{
return View();
}
catch
{
throw;
}
}