I am calling .net core action via ajax request. It's not even waiting for the return statement but as soon as I am calling Auth0 management api it's returning error.
[HttpPost]
public async Task<IActionResult> Create([FromBody]ConnectionCreateRequest model)
{
try
{
var result = await _managementApiClient.Connections.CreateAsync(model);
return Ok();
}
catch (Exception ex)
{
return Content(ex.Message);
}
}
It's returning error after result statement.
Here is the ajax call:
$.ajax({
type: "POST",
url: '@Url.Action("Create", "Connection")',
contentType: "application/json charset=utf-8",
data: JSON.stringify(model),
success: function (result) {
alert('Connections has been created successfully');
},
error: function (result, err) {
alert(err);
},
complete: function () {
hideLoadingGif();
}
});
});
What am I doing wrong?
data: model,directly... It's returning error after result statement. what the error says?model?