我想问一下我使用 PHP、AJAX 创建并包括 PHP 发送邮件功能的公司简介应用程序的通知部分。不知何故它不起作用,我不知道出了什么问题。这是我的代码:
<div class="full black">
<div class="large-12 columns">
<h2 class="white">We are ready.</h2>
<div class='form'>
<form id='contact_form'action="send.php" method='POST'>
<div class="large-4 columns">
<input class='required' name='name' placeholder='NAME' type='text'>
</div>
<div class="large-4 columns">
<input class='required email' name='email' placeholder='EMAIL' type='text'>
</div>
<div class="large-4 columns">
<input class='required' name='subject' placeholder='SUBJECT' type='text'>
</div>
<div class="large-12 columns">
<textarea class='required' name='message' placeholder='MESSAGE'></textarea>
<input id="submit" class='button white boxed contact-button' type='submit' value="Send it">
<p id='thanks' class='hide'>
Thanks for contacting us, we'll be in touch soon!
</p>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<nav>
<a href="#" id='back' class="hide">
<i class="fa fa-close"></i>
</a>
</nav>
if($('form#contact_form').length > 0) {
$('form#contact_form').validate({
messages: { },
submitHandler: function(form) {
$.ajax({
type: 'POST',
url: 'send.php',
data: $(form).serialize(),
success: function(data) {
if(data.match(/success/)) {
$(form).trigger('reset');
$('#thanks').removeClass('hide').fadeOut(5000);
}
}
});
return false;
}
});
}
这是我的发送邮件代码(我使用的是 php native):
$send_to = "toastermedia26@gmail.com";
$send_subject = "Ajax form ";
我真的很困惑。如何使用我的代码成功做出响应。有人能帮我吗。
千巷猫影