my ajax code is :
$.ajax({
url: "/Dashboard/filter",
data: jsonData,
traditional: true,
contentType: 'application/json',
dataType: 'json',
type: "POST",
success: function (data) {
console.error(data);
},
error: function (error) {
console.error(error);
}
});
and my controller action :
[HttpPost]
public JsonResult filter(Utility.FJson filterjson)
{
return Json(new { });
}
in Utility class:
public class FilterJson
{
public string IdField { get; set; }
public string NameField { get; set; }
public int Check { get; set; }
public string SFilter { get; set; }
public string TFilter { get; set; }
}
public class FJson
{
public List<FilterJson> filter { get; set; }
}
error massage is :
POST http://localhost:38064/Dashboard/filter 500 (Internal Server Error)
i want send json to mvc controller. if JSON.stringify(jsonData) in send time .in controller filterjson variable is NULL
jsonData?Utility.FJsonand also value of js objectjsonData