Skip to content
Advertisement

Sending info and variables between Client-Side and Server-Side

so I have an express.js server, I don’t quite understand how I can send and receive

I have (for example) an input for someone to write his email , I want the email to be sent to the server, validated, and then an email function sends an email to that user, However, my issue is that I don’t know how to pass the email variable from client to the server, and I don’t know how to trigger the email function as soon as the server validates the email either.

The only thing that I know to do with an express server is just routing Pages from. I tried AJAX but I think that’s overkill because I don’t understand it well and because its made to load data in a website without a reload so it has different kind of purpose.

Advertisement

Answer

Lets say your form is something like this:

JavaScript

In your express server you’d do something like this:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement