Estou tentando imprimir uma tabela usando php, ajax e mysql.
Tenho esse trecho em Html
<!DOCTYPE html>
<html>
<head>
<title>Teste Ajax</title>
<?php
require("cabecalho.php");
?>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="ajax.js"></script>
</head>
<body>
<center>
<table border="1" width="500">
<thead>
<tr>
<th>Origem</th>
<th>Papel</th>
<th>Usuario</th>
</tr>
</thead>
<tbody id="listateste">
</tbody>
</table>
</center>
</body>
</html>
ajax.js
$(document).ready(function(){
$('#listateste').empty(); //Limpando a tabela
$.ajax({
type:'post', //Definimos o método HTTP usado
dataType: 'json', //Definimos o tipo de retorno
url: 'puxa.php',//Definindo o arquivo onde serão buscados os dados
success: function(dados){
for(var i=0;dados.length>i;i++){
//Adicionando registros retornados na tabela
$('#listateste').append('<tr><td>'+dados[i].origem+'</td><td>'+dados[i].Papel+'</td><td>'+dados[i].usuario+'</td></tr>');
}
}
});
});
E PHP
<?php
header('Content-type: application/json');
include ("Conectcma.php");
$qryLista = mysql_query("SELECT * FROM reg_qm_papel", $conexao);
$resultado = array();
$resultado[] = mysql_fetch_assoc($qryLista);
echo json_encode($resultado);
?>
Se eu retorno o array dentro do próprio PHP, a array é imprimida mas aparentemente o valor não chega no Js, tirei o mysql_fetch_assoc() do loop só pra testar, mas não fez mt diferença Alguém sabe me dizer oq eu tô fazendo de errado?