Ich versuche, Ajax Antwort in json zurückzukehren, aber wenn ich es in Protokoll ausdrucken gibt es null sogar Tabellen haben Zeilen, mein PHP-Code ist:Rückkehr Tabellen Zeilen in json und Druck
if(isset($_GET['proid'])){
$projid = $_GET['proid'];
include(db.php);
$res = mysqli_query($con, "SELECT * FROM data WHERE project_id LIKE '%$projid%'");
while($row = mysqli_fetch_assoc($res))
{
$dataarray[] = $row;
}
echo json_encode($dataarray);
}
Ajax:
$.ajax({
url : 'getRecStudy.php',
type : 'GET',
data : {proid:study},
success : function(data) {
$('#tbody').empty();
$("#tbody").append(data);
console.log(data);
}
});
was ist falsch?
Was sind Ihre Konsolendaten? –
Versuchen Sie die (json_encode ($ dataarray)); – rad11
Kann man 'echo json_last_error();' – Will