So Im trying to display a table when the user clicks on a image. I came pretty far, but Im stuck and cant seem to find my mistake.
When I open up my console I get the following error:
Now Hannibal is part of the group of users I want to display in the table.
I wont post the entire code, since its alot. Ill try to keep it to the relevant parts. In this case I know that I get into my .php file that executes the query.
Since I tested the Query, I know it works so Ill just show how I give it back in my separate .php File:
$Guest_Invite_Data = filterTable($List_Guests_Query);
$Guest_Invite_Data_fetched = mysqli_fetch_array($Guest_Invite_Data);
echo json_encode($Guest_Invite_Data_fetched);
function filterTable($query)
{
$filter_Result = mysqli_query($GLOBALS['connect'], $query);
return $filter_Result;
}
And heres part of my jQuery:
success:function(Guest_Invite_Data_fetched) {
createTableByJqueryEach2(Guest_Invite_Data_fetched);
},
And heres my function:
function createTableByJqueryEach2(data2){
var eTable2="<table><tr><th colspan='5'>Gäste einladen</th></tr><tr><th>Person</th></tr>"
$.each(data2,function(index2, row2){
eTable2 += "<tr>";
$.each(row2,function(key2,value2){
eTable2 += "<td>"+value2+"</td>";
});
eTable2 += "</tr>";
});
eTable2 +="</table>";
$('#guest_table').html(eTable2);
}
Does anybody spot my mistake?
Edit: Picture of Output as requested
Edit 2: Text of the Output as requested
Array ( [0] => Hannibal [firstname] => Hannibal [1] => Lecter [lastname] => Lecter [2] => Cannibals Inc. [name] => Cannibals Inc. ) {"0":"Hannibal","firstname":"Hannibal","1":"Lecter","lastname":"Lecter","2":"Cannibals Inc.","name":"Cannibals Inc."}