Hello!
From Basic Node and Express, last exercise(number 12), Get Data from Post Requests.
The answer to the exercise number 10 works fine, everything is fine in the red circle.
The checkmark in red is what the exercise number 12 is asking us. It works fine.
How do I stop the page refreshing after we hit the submit button?
HTML
/views/index.html
<form action="/name" method="post">
<input type="submit" value="Submit">
I am searching in google, I am pretty sure is an attribute in one of those places above.
Regards,
Can you post a link to your full project code?
It only happens with the embedded preview. You won’t see that with the full page view. Not sure why but Replit does a GET after the POST and there is already a GET handler for that /name
route which is expecting query params.
It seems to only happen in the embedded view. If you click the “Open in new tab” button to the right of the address bar and do it in the full page view it doesn’t happen.
It is doing a GET after the POST to the same route /name in the embedded view. That route already exists as part of the Query Parameter challenge and is looking for a query that isn’t sent with that GET request. So the query params are missing and the values are undefined, which is then res.jsoned as part of that route.