Hi,
I am calling a simple method on WCF side using Jquery.
$.ajax({
type: "POST",
url: "MyService.svc/TestJSON",
data:'{"BikeId":"2"}',
//data: '{"BikeId":"'+ id + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert(msg);
},
error: GetFailedMessage
});
function GetFailedMessage(msg) {
alert('Error message. ' + msg.status + ' ' + msg.statusText);
}
});
My simple TestJSON is [OperationContract]
public string TestJSON(string id)
{
Bikes b = new Bikes();
b.Description = "blah blah";
b.Name = "DMX100";
b.Make = "2010";
b.ID = id;
string bikeJson = JsonConvert.SerializeObject(b);
return bikeJson;
}
I know that this method is called by using Breakpoint but the parameter "id" is null. What am I missing here? Thanks