I get this return with json_encode by php but I can not read it in ajax success, what am I doing wrong?
{"id":"1","id_pesquisa":"3","id_pergunta":"7","id_resposta":"31","mostrar":"1","ocultar":"2"},
{"id":"2","id_pesquisa":"3","id_pergunta":"8","id_resposta":"31","mostrar":"2","ocultar":"1"}
var direcao = $.ajax({
type : 'get',
url: 'dadosPS.php?ps=direcionamento',
dataType: 'JSON',
beforeSend: function (xhr) {
},success: function (data, textStatus, jqXHR) {
for(var i = 0;i<data.length;i++){
console.log(data[i].id);
}
},error: function (jqXHR, textStatus, errorThrown) {
}
});