The fact is that after sending a post request, the script takes the sent data, checks it for correctness (validity, required data, etc.) and gives an answer - either the operation was successful, or an error occurred and a list of errors (for example: error - The “name” field is not filled in. On the sending page, the corresponding message is already displayed: sending is successful or not successful.
So is there an elegant option to prevent the form from being sent again? For example, I got the idea that if you catch a page update event in javascript (if there is one to cancel it and just follow the current link. Or if you can delete any information about the request on the server after receiving the POST data, it will not be sent again as data deleted?
And a redirect is not an option. Since after the redirect, I can not send the answer script.
And fraud with an additional field with a unique value stored at the session and their further verification is also an extreme option.
What do you have any options?