Consume WCF service with Ajax

3

Hello community I have a service WCF that is published on a server X, I need to consume a method of that service through AJAX , the service method receives as parameter an object with two properties, the way in which I'm consuming the service is this:

var para = { parameters: { Propiedad1: 'xxx', Propiedad2: 'xxx' } };
        data = JSON.stringify(para);
        $.ajax({
            type: "POST",
            url: "http://RutaServicio/Service.svc/MetodoServicio",
            data: data,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {                
                alert('ok');
            },
            error: function (xhr) {
                console.log(data);
                console.log(xhr.responseText);
            }
        });

But when consuming the service, it enters through the error and message is undefined , How can I consume the service correctly?

    
asked by Sergio Fernandez 06.07.2017 в 18:27
source

1 answer

0

You must enable GET in your Web.Config. Here is a similar question and this detailed response. link

Greetings, I hope it helps you.

    
answered by 04.09.2018 в 18:05