I'm making one jQuery DataTable, in that I need to make some changes before rendering the data table.
Sample data:
[{
"time": "2018-07-18T15:16:10.557Z",
"data": "AQAAH"
}, {
"time": "2018-07-18T15:13:10.557Z",
"data": "AQAAH"
}]
I want to change the value of the data column before rendering onto the DataTable, like data:
AQAAH to 0100001c
I want to convert the data from base64
to hex
, then I want to render in the DataTable.
Code:
function getddata() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var Readings = JSON.parse(xmlhttp.responseText);
$(document).ready(function() {
$('#example').DataTable({
data: Readings,
columns: [{
"data": "time"
}, {
"data": "data"
}]
});
});
//data table code -close
}
};
xmlhttp.open("GET", "url", true);
xmlhttp.setRequestHeader("Content-type", "Application/json");
xmlhttp.send();
}