How to make an alert in the browser, using Node.js

Asked

Viewed 924 times

0

I am beginner in Node.js, I know that the main function of Node is not this, but I want to learn a little more about such an event, another doubt I also have is whether I can use common javascript functions in the "middle" of my Ode code. I would like a way to add my javascript without the function Fs.readFile()

Thank you for your attention!

1 answer

1


If you use the ajax you can do so:

In the server-side

 res.send(500,'Errooooou')

and in the client side

error: function(error){
      if(error.responseText == 'Errooooou')
          alert("Sua resposta está errada.")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.