R
R
rockwell3232020-07-13 12:54:08
JavaScript
rockwell323, 2020-07-13 12:54:08

How to output node js result to html?

Good afternoon, I am writing code using node js, which receives a response from a third-party server once a minute, I get the response naturally in the console, but how can I display it in html and so that the response in html is updated without refreshing the browser page? In the future, I want to create a full-fledged application through electron. I'm green in this, I tried through document.getElementById('content').innerHTML = result, but it doesn't work, after getting a response to the console, I get an error. Maybe someone will tell you where I can read about it, etc.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WapSter, 2020-07-13
@wapster92

Why do you need node js for this? The API can be accessed directly from the browser.

document.getElementById('content').innerHTML = result
there are no document window objects in the node. In order to show something from the node in the browser, you need to start the server, as this is done, there are plenty of manuals on the network.

S
Sergey Lyalin, 2020-07-13
@Spokik

I am also green, but it seems to me that everything is conceptually strange here. Really at you one server turns out and transfers to the client too most. But you can just immediately receive and process on the client.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question