最近我发布了一个问题PHP Script not send emails并阅读了很多类似的主题,比如AJAX JQUERY HTML EMAIL主题,但没有一个解决了我的问题。
我的问题是,当电子邮件成功发送时(我检查它),部分HTML没有运行,整个页面被刷新而不是作为主模板:(我想当发送回HTML时我无法为PHP发送响应)。我的目标只是将 PHP 文件更改为有效。
在主模板中,电子邮件的结果(发送或失败)完美完成如下,但在我的版本中存在如下问题:
HTML:
<div class="alert alert-success hidden animated fadeIn" id="contactSuccess">
<strong>Success!</strong> Your message has been sent to us.
</div>
<div class="alert alert-danger hidden animated shake" id="contactError">
<strong>Error!</strong> There was an error sending your message.
</div>
JavaScript:
jQuery(document).ready(function(e) {
"use strict";
e("#contact-form").validate({
submitHandler: function(s) {
var o = e(s),
a = e("#contactSuccess"),
t = e("#contactError"),
r = e(this.submitButton);
r.button("loading"), e.ajax({
type: "POST",
url: o.attr("action"),
data: {
name: o.find("#name").val(),
email: o.find("#email").val(),
subject: o.find("#subject").val(),
message: o.find("#message").val()
},
德玛西亚99