Answer the question
In order to leave comments, you need to log in
How to display data in a table on a website?
How to make a beautiful display of data on the site?
I am writing a website using socket.io. There is a function that takes a dictionary:
socket.on('my_pos', function(msg) {
$('#log').text('Change in 10 minutes #' + msg.count + ': ' + msg.data) ;
});
Dictionary in the msg.data variable
How can I make it so that all this is displayed not just in an ugly dictionary with all the numbers in a row, but in a table?
Answer the question
In order to leave comments, you need to log in
<table></table>
Loop through msg.data and substitute rows with the required cells into the table element like this
$("table").append("<tr><td>"+msg.data.наименование+"</td></tr>")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question