It works but the passed parameter is always null, this code is working on my other project on the ASP.NET Framework(.Net Framework) but not working in ASP.NET Core.
var inputParams = "{namex: '" + 'testdata' + "'}";
var xhr = $.ajax({
url: "/Test/MyFunction",
type: 'POST',
dataType: 'json',
data: inputParams,
contentType: 'application/json; charset=utf-8',
success: function (msg) {
},
error: function (xhr) {
}
});
The Test Controller contains:
[HttpPost]
public JsonResult MyFunction(string namex) <--- namex is always NULL
{
return Json(false);
}