Is there a way to display data after submitting a form without refreshing the page in Wordpress? I have implemented a javascript function onSubmit that hides the form div and shows the result div, but the page reloads immediately after showing the result. How can I prevent this automatic refresh?
This is the code for the first form div:
<form style="margin-top: 30px;" class="form-horizontal t-gray" id="ContactForm" method="post" onsubmit="document.getElementById('first').style.display = 'none';document.getElementById('hidden_div').style.display = ''; return true;" action="">
<div id="first">
<div class="col-md-6">
<div class="form-group">
<label for="" class="col-sm-3 control-label">Select Journey Type:</label>
...
The second div displays the submitted data from the first form:
<div id="hidden_div" style="display:none" >
<?php
...
<div class="container booking-area">
...