Skip to content Skip to sidebar Skip to footer

How To Render Variable From Node.js Server Without Have To Reload And Without Using Ejs/ajax?

I have tried using ejs: node.js: var example = 0; app.get('/', function(req, res, next) { res.sendFile(__dirname + '/public/index.ejs'); res.render(__dirname + '/public/index.e

Solution 1:

You could just use polling (the website reloads all x seconds):

<head>
  <meta http-equiv="refresh" content="3">
</head>
<body>
 <p><%- example %></p>
</body>

Post a Comment for "How To Render Variable From Node.js Server Without Have To Reload And Without Using Ejs/ajax?"