Problem with Jquery. * Failed to load resource: net :: ERR_CONNECTION_RESET

0

I'm getting through a web service the base64 url of an image that is obtained by opening an openfiledialog.

This is the function that consumes the service:

$('#Services').click(function () {

    $.ajax({
        type: 'GET',
        url: 'http://localhost:8023/PruebaServicio/GetString',
        contentType: 'application/json; utf-8',
        dataType: 'json',
        success: function (data) {
            if (data != undefined) {
                var img = document.getElementById("imgPrueba");
                img.src=data;
            }
        },
        error: function (jqXHR, textStatus, errorThrown) {
        }

    });
});

});

The problem is that it only works half of me in IE, with google chrome does not work for me. In the library jquery 2.1.1.js appears the sig. error:

xhr.send (options.hasContent & & options.data || null); * Failed to load resource: net :: ERR_CONNECTION_RESET

    
asked by Anahi Reyes 05.07.2017 в 23:16
source

1 answer

0

I do not see that you are sending a JSON to the server so try removing this line:

 contentType: 'application/json; utf-8',

I see that you are waiting for a JSON in response to the server on the line

 dataType: 'json'

If so, and still not working by removing the contentType , make sure that in the RESPONSE of your service, there if you have set the contentType with application / json and the charset with utf-8

    
answered by 06.07.2017 в 00:11