I am trying to send a parameter for a post method in restful api. Consuming service as below
$.ajax({
type: "POST",
url: "MyUrl/UpdateCustomer",
data: '{"customerJsonData": "' + "Test" + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
crossDomain: true,
success: function (data, status, jqXHR) {
debugger;
alert("success" + " " + data); // write success in " "
},
error: function (jqXHR, status) {
debugger;
// error handler
console.log(jqXHR);
alert('fail' + status.code);
}
});
Its always sending "null" for parameter customerJsonData(string type). Is there any change need to be done to make it work?
Thanks in advance