when calling a c# method from js ajax I am getting 404 error on console
I tried following ways to send data to c# method
data: '{ name: "test" }'
data: JSON.stringify({ 'name': 1234 }),
$.ajax({
url: "/api/system/AddCertificateFromStore",
type: 'POST',
data: '{ name: "divya" }',
complete: function (xhr, status) {
},
error: function (xhr, status, err) {
}
},
cache: false,
contentType: "application/json; charset=utf-8",
processData: false,
dataType: 'json'
C# method is something like this
[HttpPost]
public HttpResponseMessage AddCertificateFromStore(string CertificateName)
{
// Make the web request
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
return response;
}
Would like to send the parameters to C# method correctly so that it is being called from js ajax