I have this ajax call that gets a json array from the PHP file. I need to put the data into rows in a table which in #gamesList.
I have the append I just do not know how to go through the returned json array and put them in the append
$("#ALL").click(function(){
$.ajax({
url: 'getGames.php',
type:"POST",
dataType:'json',
data:({btn:'ALL' }),
success:function(data){
//get returned list of games
//Loop through games
//display games in table
$( "#gamesList").append('<tr><td>name</td><td>M</td><td>(2)Entries</td><td>(5)max people</td><td>($100)Fee</td><td>Prizes</td><td>7:00PM(start)</td></tr>');
}
});
}); //btn click
PHP File it returns the rows
$res = mysqli_query($c,"SELECT * FROM games");
while($row = mysqli_fetch_array($res)) {
$games[] = $row;
}
echo json_encode($games)