How do I get rid of the successful form submission message?

My website name :
I want to remove the successful form submission message, replacing it with a transition to the page I need. I tried to do this with the help of the action attribute, inserting a link to the page I need there. And this helped me get rid of the messages, but the form itself stopped being sent.

Help me solve this problem.
Here is my code:

To use a custom transition, you’d need to use JavaScript to submit the form.

Add a submit event listener, prevent the default, use fetch to submit the form:

document.querySelector('form').addEventListener('submit', event => {
  fetch('/', {
    data: newFormData(
    method: 'post'
1 Like