function SaveAccess() {
var access = new Object();
access.RoleId = $("#accessid").val();
access.Role = $("#role").val();
access.Tag = $("#tag").val();
access.Status = $("#status").val();
var data = JSON.stringify({
access: access
});
swal("Access!", "Access is successfully granted", "success");
$("#success-message").click(function (e) {
Swal.fire({
title: "Good job!",
text: "You clicked the button!",
icon: "success",
buttonsStyling: false,
confirmButtonText: "Confirm me!",
customClass: {
confirmButton: "btn btn-primary"
}
});
});
return $.ajax({
contentType: 'application/json; charset=utf-8',
dataType: 'json',
type: 'POST',
url: "/Home/SaveAccess",
data: data,
success: function (result) {
if (result.result) {
$("#AccessModal").modal('hide');
Reset();
dataTable.ajax.reload();
} else {
swal("Access Fail!")
}
},
error: function () {
swal("Error")
}
});
}
Data not Saving in my Application
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Vishal JoshiRank #377 · 6.7K reputationPosted Nov 28, 2023, 1:21 AM EST
Hello Emmanuel,
Please check the mapping parameter name mentioned in API and you are passing from the JSON request. i.e. access should be an input parameter in API. Also, check the properties inside the input type parameter.
var data = JSON.stringify({ access: access });Thanks
Vishal Joshi
Emmmanuel FIADUFERank #947 · 2.2K reputationPosted Nov 28, 2023, 5:16 AM EST
Thank you Mr Vishal,
It is working now