Wednesday, 7 June 2017

How can I send information from NodeJS server to client side?

For example, I want to signal to the client side that a username sent via the POST method in an HTML form already exists in my database.

I know how to recuperate POST data with body-parser and I know how to look it up in a MySQL database.

I know that I must use Ajax to write an error message directly on the form. What does my NodeJS server need to send and how does it send this information?

I've searched through numerous tutorials and I just found solutions where they send a new HTML page. I want to keep my web page the same and use functions like appendChild() to post the error message.



via Stefan N

No comments:

Post a Comment