0

I have a unique issue that I cant seem to find an answer for.

I have a form that submits POST data.

I have a node js server using express routes.

I am access the form data using

var name = req.body.varName

Once the page finished processing and shows the success page, the data that was sent from the form using POST method is still in the network header payload in the client.

How do I clear this POST data?

how do I clear this POST data

Joe
  • 827
  • 2
  • 9
  • 13

1 Answers1

0

You can't.

The Network tab is a client-side debugging tool that shows a history of HTTP requests.

There is no way for a website to edit that record. Not with server-side code and not with client-side code.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • So im really confused then. When my page finally processes and someone refreshes the page the POST form data is still active the page repeats and duplicates the entry… how is this possible? Where can this dats still be stored and accessible? – Joe Apr 11 '23 at 10:18
  • 1
    @Joe — "The post request is resubmitted when the user clicks refresh" and "The post request is displayed in the Network tab" are **completely** different problems. This answer answers the question you asked. [This answer](https://stackoverflow.com/a/6320124/19068) addresses the question you appear to have been trying to ask. – Quentin Apr 11 '23 at 10:22
  • I appreciate the find. However this presents a different problem. the success page is rendered using res.render and using a response variable. The error or success message. Is there a way to store a new session variable with the success message and then redirect the page instead of using render? I am not sure how this is done in nodejs. I know in PHP its session but how in nodejs? – Joe Apr 11 '23 at 11:05
  • Of course. That's a very basic use of sessions. – Quentin Apr 11 '23 at 11:07
  • So how can i store a session with nodejs? – Joe Apr 11 '23 at 11:09
  • That is well out of scope for here. If, [after doing your research](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) you still can't work it out, then [ask a new question](https://stackoverflow.com/questions/ask) – Quentin Apr 11 '23 at 11:11