0

I have an HTML form and I'm saving the form data to an XML file using PHP.

Upon submission, the page automatically refreshes - this is the default behaviour. I want to disable this, but using jQuery preventDefault also prevents saving the data.

How can I prevent it from refreshing the page, while maintaining the form functionality? Thanks.

  • You have the answer here https://stackoverflow.com/questions/45634088/how-to-prevent-page-from-reloading-after-form-submit-jquery/45634140 – melvin May 31 '18 at 18:02
  • One was is, you can override the submit preventing default and use jquery ajax to manually post the data. Code examples of what you have now would help – hawkstrider May 31 '18 at 18:02
  • try making the ` – GGw Jun 01 '18 at 03:25

1 Answers1

0

I managed to do this using an AJAX request, saving the form data to a JSON object, and then into a file. Thanks for your answers!