JSFiddle - React, Tailwind, and code Playground
HTML
<table id="employeeInformation">
<thead>
<th>first name</th>
<th>surname</th>
<th>display name</th>
<th>drivers license</th>
<th>Contact Number</th>
<th>Job Description</th>
</thead>
<tbody>
</tbody>
</table>
JavaScript
$('#employeeTable input[type=radio]').click(function() {
var employeeKey = $(this).val();
var request = $.ajax({
url : "/PHP/employeeData.php",
type : 'post',
data : {'key':employeeKey}
}).done(function(returnedData){
console.log(returnedData);
$("#employeeInformation").show(100);
$("#employeeInformation").DataTable({
data: returnedData,
columns: [
{data :"surname"},
{data :'surname'},
{data :'display name'},
{data :'drivers license'},
{data :'Contact Number'},
{data :'Job Description'}
]
});
});
});
*/
Data returned :
[{"key":"10","id":"1","first name":"Jackson","surname":"Harkness","display name":"Jack Harkness","gps req":"0","lockout enab":"0","lockedout":"0","siteAdmin":"1","adminOnly":"0","drivers license":"99999999","Contact Number":"6666666666","Job Description":"Head of torchwood","template1":"","template2":"","template3":"","template4":"","template5":"","template6":"","template7":"","template8":"","template9":"","template10":"","Last Modified":"2014-05-24 08:51:28"}]
Error message:
DataTables warning: table id= employeeInformation - requested unknown parameter 'first name' for row 0.
/*