I'm trying to send a complex object, via javascript function, to the ActionResult.
In view:
function SubmitEORequest() {
var url = '/Home/ExecuteOperation';
var field = {
Name: "fieldname",
Value: "fieldvalue"
};
//
$.ajax({
url: url,
type: 'post',
data: JSON.stringify(field),
contentType: 'application/json',
dataType: 'json',
success: function (data) {
}
});
}
No controller:
[HttpPost("Home/ExecuteOperation")]
public ActionResult SubmitEORequest([FromBody] Field in_data)
{
Field f = new Field();
f.Name = in_data.Field (null)
}