There are many different ways to send data from an HTML form to a server. I wanted to provide a deep dive into using the FormData JavaScript interf...
For further actions, you may consider blocking this person and/or reporting abuse
Cool to see that, this topic is quite underpaid with attention in our SPA world 🙂
Thanks!
The thing you didn't mention here that I can't seem to find ANYWHERE going elbow deep into documentations and tutorials is this:
How do I
for a form submission, then add data to the form via form.append so I can add extra data that is not user submitted to the form, and then submit that form so I can access that data on my node server AND then redirect the user to another page?
For example if I don't
and go the urlencoded() route my page will get redirected from the server side using
without me being able to add extra key:value pairs to the form such as
but once I
I can create, and send a FormData object, adding the extra fields I want to it such as
, using a fetch request. Once this Content-Type header is no longer the form default however how do I then use something like res.sendFile() server side to then redirect the user? When I try to do this using either mulitpart form OR json I just run into a brick wall. I can access all the data server side and make conditionals using the request body however when I try to use
to redirect the user I get no errors and nothing happens.