Answer the question
In order to leave comments, you need to log in
How to render website data in a table using JS?
There is a function that takes a dictionary with fields ['Name'] and ['Price']. How to draw a conclusion so that the name is displayed in the table and next to the price, while when new data arrives, the old ones are updated with new ones, and not just added (this has already been done)
socket.on('my_pos', function(msg) {
$("#log1").html('');
var fir = msg.data['Name']
var sec = msg.data['Price']
fir.forEach(item => $("#log1").append(`<tr><td>${item}</td></tr>`));
sec.forEach(item => $("#log1").append(`<tr><td>${item}</td></tr>`));
});
<table id="log1" border="1" width="100%" cellpadding="15"></table>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question