Click here to Skip to main content
14,447,974 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

I think you need to stringify.

Refer - Sending JSON to WCF Rest Service - object is always null[^]
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100