4

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);
                }

            });
Pradeep
  • 3,258
  • 1
  • 23
  • 36
user601367
  • 2,308
  • 12
  • 34
  • 44
  • Did you try debugging your service? 400 error can be returned when there is an internal error. – markt Mar 18 '11 at 05:01

1 Answers1

3

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

Pranay Rana
  • 175,020
  • 35
  • 237
  • 263