When I do this, return is a parsererror.
$.ajax({
type: "GET",
url: "servicos.php",
data: "id=1",
dataType: 'json', ==========================> Essa linha bem aqui
success: function(retorno,status){
// retorno = JSON.parse(retorno);
$("#tudo").html(retorno);
},
error: function(retorno,erro){
$("#tudo").html(retorno.responseText);
}
});
It only gives success if you remove this line or leave it as 'text'.
But (still leaving dataType: 'json'), when I ask to return the error of this fomra:
error: function(retorno,erro){
$("#tudo").html(retorno.responseText);
}
I get the same success result without the "dataType: 'json'"
I did not understand that.