You should prepare .lp file in/user/ location(e.g. logs.lp) and inside you must prepare in lua such script:
And when you will have this file you can use it in js by:
Code:
<?
-- How much objects do you need?
objects_number = 10
query = "SELECT ol.logtime, o.name, ol.datahex, o.datatype, ol.eventtype FROM objectlog AS ol, objects AS o WHERE ol.address=o.address AND ol.eventtype IN ('write', 'response') ORDER BY ol.logtime DESC LIMIT " .. objects_number
result = db:getall(query)
logs = {}
for _,row in ipairs(result) do
logs[_] = {logtime = os.date('%Y.%m.%d %H:%M:%S', row.logtime), name = row.name, value = knxdatatype.decode(row.datahex, row.datatype)}
end
logs = json.encode(logs)
print(logs)
?>
And when you will have this file you can use it in js by:
Code:
$.get( "/user/logs.lp", function( data ) {
res = data.trim();
res = JSON.parse(res);
// further operating with data in javascript ;)
};