If you click the button, the default behavior is submitting the page (if the button is within the form, etc.). We don't know the exact details of the button with class
button confirm
, how it is setup, what parent it has, etc. If you can share the HTML, we can further help you (
note that we will not open the website, download an HTML file and then run it... Nope!).
One of the ways in which you can prevent the page from reloading is to handle the button click event and put
event.preventDefault()
inside the button click handler.
Secondly, if you want to submit the form, you can manually create the
FormData
object and submit the data to the server without the browser handling the form submission itself.
Read more here:
FormData - Web APIs | MDN[
^]
Event.preventDefault() - Web APIs | MDN[
^]