Ajax only results in the console?

1

Good afternoon guys, I can get a result in the log, but the div is not passed, my source follows:

Index.php

var teste;
$.ajax({
    url: 'conversa.php',
    type: 'GET',
    success: function(res) {
        $("#conversa").html(res);
        teste = $("#conversa").html(res);
        console.log(document.getElementById("conversa"));
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

chat.php

<?php
include '../../abreConexao.php';
session_start();

$query = "SELECT * FROM chat WHERE meu_id='" . $_SESSION['id-cadastro'] . "' AND parceiro_id='" . $_SESSION['paquera_chat'] . "' OR meu_id='" . $_SESSION['paquera_chat'] . "' AND parceiro_id='" . $_SESSION['id-cadastro'] . "' ORDER BY data_hora ASC";
$result = mysql_query($query);
while ($fetch = mysql_fetch_array($result)) {
    $variavel .= '{"_id":"' . $fetch['parceiro_id'] . '","text":"' . $fetch['mensagem'] . '","userId":"' . $fetch['meu_id'] . '","date":"' . $fetch['data_hora'] . '"},';
}
echo $variavel; 	
?>

Ijustwantedtogettheselectoftheconversation.phpanddisplayitintheindexviaajax.Staytuned,thanks.

-Resolved

$.ajax({ 
		url: 'conversa.php', 
		type: 'POST', 
		success: function(res){ 
		  $("#conversa").empty();
		  $("#conversa").append(res);
		  teste = document.getElementById('conversa').innerHTML; 
		  console.log(document.getElementById("conversa"));
		}
	  });
    
asked by anonymous 20.10.2016 / 19:49

0 answers