vendredi 11 septembre 2020

How do I log a HTML page button click with node.js?

So i have a button in a HTML page, which came from a node.js server.js

http.createServer(function (req, res){
  res.writeHead(200,{'Content-Type': 'text/html'} );
  res.end(`<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width, initial-scale=1"><style>.loader{border: 16px solid #f3f3f3; border-radius: 50%; border-top: 16px solid #3498db; width: 120px; height: 120px; -webkit-animation: spin 2s linear infinite; /* Safari */ animation: spin 2s linear infinite;}/* Safari */@-webkit-keyframes spin{0%{-webkit-transform: rotate(0deg);}100%{-webkit-transform: rotate(360deg);}}@keyframes spin{0%{transform: rotate(0deg);}100%{transform: rotate(360deg);}}</style></head><body>Server Time is: ${dt.getDate()}<div class="loader"></div>Loading...</br><button type="button">Click Me!</button></body></html>`)
  console.log("Page opened somewhere")
}).listen(8080)

So i want to create a variable and every time that button on the page is clicked, i want it to increment the value by one and update it on the page.

I already saw this, but i don't want to use a database.

How exactly do I make this?

Sorry for the bad question




Aucun commentaire:

Enregistrer un commentaire