gpt4 book ai didi

javascript - 表单提交后加载CSS模态

转载 作者:行者123 更新时间:2023-11-28 02:05:33 25 4
gpt4 key购买 nike

我试图为我的代码找到 JS 和 ajax 解决方案,但它们都不起作用我想在用户单击提交按钮后加载模态,并且仅在模态加载后发送表单并将值提交到 email 。我尝试了很多次,但我无法成功,所以如果有人能帮助我解决这个问题,那就太好了。这是我的代码。

$(document).ready(function() {
$('#questionWrapper .question').first().show(); //show first questionblock

$("#questionWrapper .answer").click(function(event) {
event.preventDefault();
$(this).parent('.question').hide();
if ($(this).parent().next('.question').length) {
$(this).parent().next('.question').fadeIn();
} else {
startCheck();
}
});
});

function startCheck() {

var overlay = $('.overlay-checker'),
points = $('.overlay-checker-points > li');

// Initially, hide all the points so we can show them one by one
points.hide();

// Fade in the overlay
overlay.fadeIn();

// Loop points.lenght times (so through every point)
for (i = 0; i < points.length; i++) {
setTimeout(function() {
$('.overlay-checker-points').find(':hidden').first().fadeIn();
}, 1500 * (i + 1));
}

// After all items have been faded in, redirect
setTimeout(function() {

document.getElementById('overlay-checker').click();
}, 1500 * points.length + 4000);

}


function toggleDiv(target) {
$(target).toggle();
}
<?php
/*
From http://www.html-form-guide.com
This is the simplest emailer one can have in PHP.
If this does not work, then the PHP email configuration is bad!
*/
$msg="";
if(isset($_POST['submit']))
{
/* ****Important!****
replace name@your-web-site.com below
with an email address that belongs to
the website where the script is uploaded.
For example, if you are uploading this script to
www.my-web-site.com, then an email like
form@my-web-site.com is good.
*/
$lname=$_POST['name'];
$email=$_POST['email'];
$country=$_POST['country'];



$from_add = "useremail";

$to_add = "myemail@gmail.com"; //<-- put your yahoo/gmail email address here

$subject = "Form User Submmitted";
$message = "<html><head>
<title>Message</title>
</head>
<body>
<p><strong>From:</strong> $name</p>
<p><strong>Email:</strong> $email</p>
<p><strong>Country:</strong> $country</p>

</body>
</html>";

mail($to_add, $subject, $message, $headers);


$headers = "From: $from_add \r\n";
$headers .= "Reply-To: $from_add \r\n";
$headers .= "Return-Path: $from_add\r\n";
$headers .= "X-Mailer: PHP \r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "MIME-Version: 1.0\r\n";


if(mail($to_add,$subject,$message,$headers))
{
header('Location: google.com');
}
else
{
header('Location: google.uk');
}
}
?>
      <div id="form-div">
<form class="form" method="post" id="form1" action=refreshform.php>

<p class="name">
<input name="name" type="text" class="validate[required,custom[onlyLetter],length[0,100]] feedback-input" placeholder="Name" id="name" />
</p>

<p class="email">
<input name="email" type="text" class="validate[required,custom[email]] feedback-input" id="email" placeholder="Email" />
</p>

<p class="country">
<input name="country" type="text" class="validate[required,custom[onlyLetter],length[0,100]] feedback-input" placeholder="Country" id="country" />
</p>
<p class="apps">to ensure your not a bot <strong>you must download 2 FREE Apps</strong> and only after the GiftCard will be Sent.</p>




<div class="answer">
<input class="submit" name="submit" type="submit" value="Check & Verify" id="blue-button"/>
<div class="ease"></div>
</div>
</form>

</center>
</div>
</div> <!--End of questionWrapper .alpha60-->
</div> <!--End of wrapper-->


<div class="overlay-checker">
<div class="centerIt">Checking your answers...

<ul class="overlay-checker-points centerIt">
<li><img src="img/check.png"> No double registrations found on IP.</li>
<li><img src="img/check.png"> <span style="color: red; font-size: 28px;">2 </span>Card is available.</li>
<li><img src="img/check.png"> Congratulations. Please proceed to App Download Verification...</li>
</ul>

<div class="terms">Additional T&amp;C may apply.</div>

</div>
</div>

最佳答案

您可以让您的提交按钮调用一个 JavaScript 方法来打开您的模式,然后调用 $("form").submit () https://api.jquery.com/submit/

关于javascript - 表单提交后加载CSS模态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49043316/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com