Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ajax-Form-Js
<script>
$("form.callback").submit(function () { //Change
var th = $(this);
$.ajax({
type: "POST",
url: "mail.php", //Change
data: th.serialize()
}).done(function () {
$(th).find('.success').addClass('active').css('display', 'flex').hide().fadeIn();
setTimeout(function () {
$(th).find('.success').removeClass('active').fadeOut();
// Done Functions
th.trigger("reset");
$.magnificPopup.proto.close.call(this);
}, 3000);
});
return false;
});
</script>
<div class="success"><span>Thanks for applying!</span></div>
<!-- Hidden Required Fields -->
<input type="hidden" name="project_name" value="WhyNot">
<input type="hidden" name="admin_email" value="privetwhynot@gmail.com">
<input type="hidden" name="form_subject" value="Заявка">
<!-- END Hidden Required Fields -->
<style>
.success {
display: none;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-transform: uppercase;
font-weight: 700;
z-index: 10
}
.success span {
margin: auto;
color: #fff;
font-size: 30px;
letter-spacing: 1px
}
.success~* {
-webkit-transition: all .5s ease;
transition: all .5s ease
}
.success.active~* {
opacity: .6;
-webkit-transition: all .5s ease;
transition: all .5s ease;
-webkit-filter: blur(10px);
filter: blur(10px)
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.