kowalcyck
kowalcyck

Reputation: 113

Error : invalid character

I get this error:

Unhandled exception at line 993, column 29 in http://localhost:1810/Titulares/Create?Length=9

0x800a03f6 - Error en tiempo de ejecución de JavaScript: Carácter no válido (JavaScript Runtime Error : Invalid character)

The line 993 is:

var response = JSON.parse(XMLHttpRequest.responseText);

And all code is:

function Ajax_EstadoEmpresa(dataToSend) {
    debugger;
    var jsonStr = JSON.stringify(dataToSend);
    jQuery.ajax({
        type: "POST",
        url: "/Titulares/EstadoEmpresa",
        data: jsonStr,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (result) {
            Success_EstadoEmpresa(result);
        },
        error: function (XMLHttpRequest, textStatus) {
            var response = JSON.parse(XMLHttpRequest.responseText);
            if (response.Message) {
                alert(response.Message);
            } else {
                alert(textStatus);
            };
        }
    });
}

Upvotes: 0

Views: 3697

Answers (1)

Prasanna Kumar H A
Prasanna Kumar H A

Reputation: 3431

Dont use JSON.parse since you already mentioned in datatype it as "JSON".Please remove that and try executing.

Upvotes: 1

Related Questions