休会
很抱歉延迟回复,但另一个项目优先。我遵循了 dimitry 建议并添加了 ajax 调用。使用经过验证的 jquery 和 jquery 表单进行前端验证以发送 ajax。
我声明网站页面的管理委托给 php 交换机。
如果表单没问题,它应该使用简单的自定义消息(hello NAME, .... MAIL)转到thanks.php 并调用执行phpMailer 的form-validation.php。我可以使用 window.location.href 访问thanks.php,但数据不会传递到 php 页面,而且我不知道如何调用两个不同的页面。
HTML 代码(基本)
<form method="post" action="thanks" id="form_contatti" class="contact100-form" autocomplete="on">
<div class="form-group col-lg-12">
<input type="text" name="name" class="form-control" placeholder="Name*" autofocus value="" required>
</div>
<div class="form-group col-lg-12">
<input type="text" name="surname" class="form-control" placeholder="S*" autofocus valueurname="" required>
</div>
<div id="Pulsante" class="text-center">
<!-- Generated With Jquery on page ready -->
</div>
</form>
验证码
submitHandler: function(form) {
$.ajax({
url: 'form_validation.php',
type: $(form).attr('method'),
data: $(form).serialize(),
cache: false,//On dev disable cache. Remove on production
success: function(response) {
alert("Thank you for your comment!");
window.location.href = $(form).attr('action');
}
});
}
我试图使调用同步,在 get 中插入两个调用,然后在 post 中插入第二个 ajax,但没有。
我正在使用 phpmailer 从表单发送数据,不幸的是我还必须发送两个文件(简历和求职信),这会减慢它的速度(加载页面需要超过 5 秒)。
Aruba 服务器,
HTTPS,
无数据库
Windows 主机,
Php 7.2 可用
使用 auto@domainname.ext 从表单中输入的地址发送电子邮件。
我没有直接访问权限(服务器和 aruba 管理面板都没有),因此我无法安装/修改/配置/启用任何东西。
有没有办法使发送异步或什么?
我在这里查看了其他答案,但它们不适合我,因为他们计划安装库或更改设置。
如果需要,我可以附加服务器的 info.php 屏幕。
我几乎没有 php 经验,而且我不知道面向对象的编程,所以这一切都更加困难。
非常感谢。