1

I have a contact form on my web site included where visitors have to fill in their name, address and email and now I try to add a content locker (javascript) which shall appear once they click on the "submit" button. The "onclick" works but the site automatically moves forward to the "submit.php" site and closes the content locker in seconds. I also want to have the visitors data already saved in case they close the site without paying attention to the PopUp. Is this possible?

Regards

2 Answers2

0

Have you tried delaying the submission?

<script type="text/javascript">
        $(document).ready(function() {
            $('#myform').submit(function(e) {
                e.preventDefault();

                setTimeout(function () {
                    form.submit();
                }, 3000); // in milliseconds
            });
        });
    </script>
ltalhouarne
  • 4,586
  • 2
  • 22
  • 31
0

have you considered using AJAX?

use JQuery to lock the data in the form and send all the data to your submit.php with

<script>
$("input").prop('disabled', true);
var data = $('form').serialize();
$.post('url', data, function(){
 // do something when done saving
});
</script>

Information given from this answer: Pass entire form as data in jQuery Ajax function

Community
  • 1
  • 1