Beauty? It's as follows, I have an ajax method that returns a json, the problem is that this ajax does not run on mobile devices. It always returns me fail, however, on the pc, everything happens normally.
jQuery.ajax({
url: url,
method: "get",
dataType: "json"
}).done(function(retorno){
for(var i = 0; i < retorno.myArrayList.length; i++) {
if(retorno.myArrayList[i].map.status == 1) {
retorno.myArrayList[i].map.status = "Aberta"
} else if(retorno.myArrayList[i].map.status == 2) {
retorno.myArrayList[i].map.status = "Paga"
} else {
retorno.myArrayList[i].map.status = "Cancelada"
}
linha += '<tr>';
linha += '<td>' + retorno.myArrayList[i].map.nomePaciente + '</td>';
linha += '<td><a href="'+ retorno.myArrayList[i].map.idFatura + '" data-fatura="' + retorno.myArrayList[i].map.idFatura + '">' + retorno.myArrayList[i].map.nomeFatura + '</a></td>';
linha += '<td>' + retorno.myArrayList[i].map.valorFatura.toLocaleString('pt-br',{style: 'currency', currency: 'BRL'}) + '</td>';
linha += '<td>' + retorno.myArrayList[i].map.vencimento + '</td>';
linha += '<td>' + retorno.myArrayList[i].map.dataPagamento + '</td>';
linha += '<td>' + retorno.myArrayList[i].map.status + '</td>';
linha += '</tr>';
totalRec += retorno.myArrayList[i].map.valorFatura;
}
table.append(linha);
retorno = "";
$(".tr-modal").text(totalRec.toLocaleString('pt-br',{style: 'currency', currency: 'BRL'}))
$(".modalConta-back").fadeIn();
$(".modalConta").css("transform", "translateX(0)");
}).fail(function(erro){
alert(erro);
});
The request always fails but on the PC everything happens normally. The fail to return an object but I can not handle or verify the error or the pq does not generate json on the cell.
I generate the url through jquery when you click on the table row.
var dia = ($(this).find("td:nth-child(1)").text() < 10) ? "0" + $(this).find("td:nth-child(1)").text() : $(this).find("td:nth-child(1)").text();
var mes = $("#month").val();
var ano = $("#year").val();
var url = http://localhost:8080/meusite/api/findAllContatoFaturasJson.do?day="+ dia + "&month=" + mes + "&year=" + ano +"&tipo=2&p1=0&dentistaId=&vendedorId=&formaPagamentoId=";