Using WCF / REST service using jQuery ajax post

I am trying to publish usign $ .ajax data, but I am getting 400 error message. The code below is:

$.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); } }); 
+4
source share
1 answer

here is my blog for you: Create a REST service with WCF and consume using jQuery

A REST service with WCF and consumption, using jQuery by mail, you can easily solve the problem in just 2 or 3 minutes, though

Other

Steps for invoking a WCF service using jQuery

Calling WCF Service Using JQuery / Javascript

+3
source

Source: https://habr.com/ru/post/1344223/


All Articles