S
S
Swift-U2019-02-15 22:25:07
AJAX
Swift-U, 2019-02-15 22:25:07

How to make a "Thank you" form after submitting an application without reloading the page?

There is a PHP code for submitting to the
kidney

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Talyan, 2019-02-15
@flapflapjack

https://codepen.io/antipetya/pen/KJrwrK
bfy.tw/MKDZ
The answer was right there
Submitting the form without reloading the page?
Instead of alert("Thanks");
Write what you want.
You can, for example, erase the shape, and instead draw a hidden DIV with thanks, which you design at your discretion.

R
Roman, 2019-02-16
@procode

using jQuery it might look something like this
HTML:

<div id="container1">
//здесь ваша форма
</div>
<div id="container2">
//здесь благодарности
</div>

in css
and if Ajax worked successfully - call this:
function fadeonsuccess() {
        
        $('#container1').fadeOut(700, "linear", function(){
          $('#container2').delay(400).fadeIn(700, "linear").delay(3000).fadeOut(700, "linear", function(){
            formreset();
            $('#container1').fadeIn(700);		
          });					
        });				
      }

It will make you fade one on top of the other so beautifully)))
voila! :)

T
TCloud, 2019-02-16
@OTCloud

All the same, it’s not worth making such gaps on the site?
1) How about placing the gratitude form (html) in the gratitude_form.php file
2) Let's still use the ajax object correctly and fully, and upon successful submission of the first form, we will do $.ajax( {...}.success( function () { ... } ) )
3) In the .success() function, it is worth unloading our gratitude_form.php file into the container we need using the same require_once or get the form html as a string and make $( "container_ID" ) in js. text("form_html_string" )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question