My data model class looks as below:
[DataContract] public class Order { [DataMember] public string Id { get; set; } [DataMember] public string Additio
There were two issues in getting this resolved. 1. Some bug in my service itself (this is my bad) 2. I had do to JSON.stringify() on the orderJson object.
function SaveOrder() { var orderJson = { AdditionalInstructions: $("span:first").text(), Customer: { FirstName: $("#firstName").val(), LastName: $("#lastName").val() }, OrderedProduct: { Id: $("#productList").val(), Quantity: $("#quantity").val() } }; // the post to your webservice or page $.ajax({ type: "POST", //GET or POST or PUT or DELETE verb url: "http://localhost:14805/OrderService.svc/SaveOrder", // Location of the service data: JSON.stringify(orderJson), //Data sent to server contentType: "application/json; charset=utf-8", // content type sent to server dataType: "json", //Expected data format from server processdata: false, //True or False success: function (result) {//On Successfull service call RedirectToMvcApp(result); }, error: function (request, error) {// When Service call fails alert('Service call failed: ' + request.status + ' ' + request.statusText); } }); }