<div class="col-md-6 col-xl-4">
<div class="input-field">
<form id="callphone">
<!-- Hidden Required Fields -->
<input type="hidden" name="project_name" value="a">
<input type="hidden" name="admin_email" value="b">
<input type="hidden" name="form_subject" value="c">
<!-- END Hidden Required Fields -->
<input id="phone-email" name="phoneemail" class="form-control" type="text"size="40" required>
<label for="phone-email" class="animated-label">введите ваш email или номер телефона</label>
</form>
</div>
</div>
<div class="col-md-6 col-xl-4">
<div class="buttons">
<div id="sub" class="callback">
<p>заказать<br> обратный звонок</p>
</div>
<div class="send-email">
<p>отправить<br> e-mail </p>
</div>
</div>
</div>
//form email+call
$('#sub').click(function () {
$('#callphone').submit(function () {
let th = $(this);
$.ajax({
type: "POST",
url: "./mail.php",
data: th.serialize()
}).done(function() {
alert("www");
setTimeout(function() {
// Done Functions
th.trigger("reset");
}, 1000);
});
return false;
})
});
通过单击#sub,您只需在提交事件上注册#callphone 表单处理程序。该事件的处理注册应该发生在点击之前,并且应该在点击时调用submit()方法
像这样的东西,例如: