Closing modal window after form submit?

Help please, website for doing wrodpress. Put an order form call the pop-up.
Don't know how to make so that after clicking on the order button sent the letter,but the form was closed. If you use data-dismiss = “modal” then the form just closes without sending the letter.
Tell me what to do. Here is the piece of code that it baffles me
//Here I call a modal window

 <script type="text/javascript">
 var delay_popup = 2000;
 setTimeout("document.getElementById('bg_popup').style.display='block'", delay_popup);

//Open the window

<div id="bg_popup">
<div id="popup">
<p>Text modal window</p>

<div role="form" class="wpcf7" id="wpcf7-f1830-p2-o4">

<form action="/#wpcf7-f1830-p2-o4" method="post" class="wpcf7-form" novalidate="novalidate">
<input type="tel" name="your-tel" value="+7" size="40" class="wpl" aria-required="true" aria-invalid="false" /></span>
<input type="submit" value="order" class="btn btn-default" />


the <script>
March 19th 20 at 08:53
0 answer

Find more questions by tags HTMLJavaScriptCSS