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")
}
});
}
Loading
Vishal JoshiPosted Nov 28, 2023, 6:21 AM
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.
Thanks
Vishal Joshi
Emmmanuel FIADUFEPosted Nov 28, 2023, 10:16 AM
Thank you Mr Vishal,
It is working now