I have now a table in mysql that I push out every 3:rd second but I will try to push it out only when the table is updated. I use node.js for this but my first priority now is to have a "time since added at the end of the row for each record that I show (max 20 records). Here is a part of my script on my server side (nodejs)
socket.on('notification', function (data) {
var resultsList = "";
resultsList += "<h1>Title</h1>";
//resultsList += "<span id=\'ct\' ></span>";
resultsList += "<table border='1'><tr>";
resultsList += "<font size=18>";
resultsList += "<td width=200> Column1</td><td width=100>Column2</td><td width =200>Column3</td>";
$.each(data.results,function(index,result){
resultsList += "<tr>" + "<td>" + result.Column1 + "</td>" + "<td>" + result.Column3.toFixed(2) + "</td><td>" + result.Column2 + "</td></tr>";
});
resultsList += "</tr>";
$('#container').html(resultsList);
});
I have a "result" table in mysql that I easily publish on a webpage but I would like to add a "timeSinceUpdated" column at the end for every row and the time shall tick while watching the webpage. I also want to have the webpage updated without the need for the users to do a refresh in their web browsers. What is the best approach?