Click here to Skip to main content
15,847,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to send a parameter for a post method in restful api. Consuming service as below

type: "POST",
url: "MyUrl/UpdateCustomer",
data: '{"customerJsonData": "' + "Test" + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
crossDomain: true,
success: function (data, status, jqXHR) {
alert("success" + " " + data); // write success in " "
error: function (jqXHR, status) {
// error handler
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

1 solution

I think you need to stringify.

Refer - Sending JSON to WCF Rest Service - object is always null[^]
Share this answer
Mada Naga Sankar 6-Sep-15 13:55pm    
I tried this, still value is null.
Did you debug? Is it going inside that method?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900