Reputation: 2378
I am trying to post the data usign $.ajax, but I am getting failure message 400 error. Following is the code:
$.ajax({
url: "http://192.168.1.9:150/Service.svc/usrregistration",
type: "POST",
// data: '{"Firstname":' + Firstname + ',"LastName:"'+LastName+'}',
data: '{"Firstname":"rose"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
processdata: true,
success: function (msg) {
alert(msg);
alert('Registerd successfully');
},
error: function (msg) {
alert('Faild'+msg.status);
}
});
Upvotes: 4
Views: 24260
Reputation: 176956
here is my blog post for you : Create REST service with WCF and Consume using jQuery
REST service with WCF and Consume using jQuery by post you can figure out the problem easily its just 2 or 3 min walk though
Others
Steps to Call WCF Service using jQuery
Calling Cross Domain WCF service using Jquery/Javascript
Upvotes: 3