D
D
DimaDimon12018-03-05 10:02:28
Flask
DimaDimon1, 2018-03-05 10:02:28

How to output data to the site?

I use the flask_socketio library, how to make the data that came to me not be displayed in a new div (the code is just below), but changed in the existing div to new ones. Here is the code itself:

socket.on('my_pos', function(msg) {
                $('#log').append('<br>' + $('<div/>').text('Received #' + msg.count + ': ' + msg.data).html());
            });
<div id="log"></div>

Here a new div is created every time data arrives

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2018-03-05
@DimaDimon1

Some hellish code, meaningless and merciless.

$('#log').text('Received #' + msg.count + ': ' + msg.data);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question