javascript Post to ActionResult (MVC) does not pass data

0

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)  

}
    
asked by anonymous 15.10.2018 / 19:16

0 answers