I have the following code
function fncGetUsuarioProducao(p1) {
$.ajax({
type: "POST",
url: "cadRecebimentoProducao.aspx/GetUsuarioCartaoAcesso",
data: JSON.stringify({ codCartaoAcesso: p1 }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
if (result.length == 4) {
$("#divAlerta").css("display", "");
return false;
} else {
$("#divAlerta").css("display", "none");
var json = JSON.parse(result);
//$("#txtQuantidade").val(json.IdUsuario);
opener.document.getElementById("hiddenIdUsuario").value = json.IdUsuario;
opener.document.getElementById("txtUsuarioProducao").value = json.Funcionario.ContaUsuarioDominio;
window.opener.document.form1.submit();
window.parent.close();
}
},
failure: function (response) {
alert(response.d);
}
});
}
This code has been working since 2018. This week it started having problems. When this code is executed, I receive the following error message
Uncaught SyntaxError: "[object Object]" is not valid JSON
at JSON.parse (<anonymous>)
at Object.success (cadRecebimentoProducao.aspx?IdSolicitacaoAnalise=359139&Quantidade=2&Unidade=LI:153:41)
at j (jquery.min.js:2:26925)
at Object.fireWith [as resolveWith] (jquery.min.js:2:27738)
at x (jquery.min.js:4:11253)
at XMLHttpRequest.<anonymous> (jquery.min.js:4:14765)
I inserted console.log(result) before json.parse, and put the json that appeared in a validator, and the json was ok. Does anyone know what can it be?