我一直在我的一个网站上使用formspree。一开始工作正常,然后表单消息没有发送电子邮件。我发送表单时会看到名称和消息,但电子邮件不会注册。我查看了短代码,并没有看到我的结果。有没有人在这看到这个问题?
我也有我的"我正在寻找报价"在大多数浏览器中,措辞重叠我的复选框。我把它拿出来拿出来,但我认为可能会弄乱代码。对此有何想法?
这是HTML:
<form role="form" id="formspree" method="post">
<div class="form-group">
<label class="sr-only" for="contact-name">Your Name</label>
<input type="text" name="name" placeholder="Your Name" class="contact-email form-control" id="contact-email">
</div>
<input type="text" name="_gotcha" style="display:none">
<div class="form-group">
<label class="sr-only" for="contact-email">Email</label>
<input type="text" name="email" placeholder="Email" class="contact-email form-control" id="contact-email">
</div>
<div class="form-group">
<label class="sr-only" for="contact-message">Message</label>
<textarea name="message" placeholder="Message" class="contact-message form-control" id="contact-message" style="height: 168px;width:100%;"></textarea>
</div>
<div class="row">
<div class="col-sm-6" style="
text-align: right;
padding-right: 15px;
<div class="form-group"><label class="checkbox-inline"><input id="looking_for_quote" type="checkbox" value="quote">I'm Looking For A Quote</label>
</div>
</div>
<div class="col-sm-6">
<button type="submit" class="btn btn-lg"> Send Message</button>
</div>
</div>
</form>
这是脚本:
$(document).ready(function() {
// process the form
$('form[method=post]').submit(function(event) {
var email = "mat.mcsales@verizon.net";
if ($('#looking_for_quote').is(':checked')) {
email = "orders.mcsales@gmail.com";
}
$.ajax({
url: "https://formspree.io/" + email,
method: "POST",
data: {
message: $('textarea').val(),
from: $('input[name=name]').val(),
_reply: $('input[type=email]').val()
},
dataType: "json",
success: function() {
alert("Thanks! We'll get back to you soon.");
}
});
// stop the form from submitting the normal way and refreshing the page
event.preventDefault();
});
});
答案 0 :(得分:0)
我认为我认为..我改变了_reply:$(&#39;输入[type = email]&#39;)。val()发送电子邮件:$(&#39;输入[name = email] ]&#39;。)VAL()