Sorry for the bad titling, I had difficulty naming it.
I am trying to take this data:
<?php
require '../lib/config.php';
// Get the server statuses
$pdb = connectPDO();
$stmt = $pdb->prepare('SELECT * FROM serverlist');
$stmt->execute();
echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
Which gives this result: http://ichris.xyz/ajax/server-status.ajax.php
and then take that data and insert it into a table http://ichris.xyz/server_list.php (the table I have made to insert this data).
You can use
$.get('ajax/server-status.ajax.php').done(function(results) {
var statusList = $.parseJSON(results);
var tableBody = $("table tbody");
if ($.isArray(statusList)){
for(var index in statusList){
var status = statusList[index];
$("<tr>").append("<td>"+status["name"]+"</td>")
.append("<td>"+status["faction2_name"]+"</td>")
.append("<td>"+status["map"]+"</td>")
.append("<td>"+status["players_online"]+"/"+status["players_max"]+"</td>")
.append("<td>"+(status["has_password"] ? 'Yes' : 'No')+"</td>")
.appendTo( tableBody );
}
}
});
See it in action in a JSFiddle demo
Use JSON DECODE: http://php.net/manual/en/function.json-decode.php
Once you serialize the json feed, then using a while or for loop run your inserts using php.