确认页面的最佳方法

发布于 2024-09-11 17:13:58 字数 240 浏览 3 评论 0原文

我刚刚完成了没有 Flash 的联系页面的基本设计结构;它位于此处

任何人都可以建议制作确认脚本(在 DIV 内)而不重新加载页面(最好使用 jQuery)的最佳方法。我想用新内容(只是文本)替换主 WRAP 中的内容,以确认已收到电子邮件。

有什么建议吗?

I just finished the basic design structure for my contact page without flash; it's located here.

Can anyone suggest the best approach for making a confirmation script (inside a DIV) without reloading the page (preferably with jQuery). I want to replace the content in the main WRAP with new content (just text) confirming the email was received.

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天邊彩虹 2024-09-18 17:13:58

首先,我不相信您可以通知用户确实收到了邮件(至少不是以一种微不足道的方式)。但您可以通知它已发送。
为此,您可以使用 jQuery 通过 AJAX 发送联系信息,然后在 DIV 中显示响应。
可能是这样的:

$.ajax({
   type: "POST",
   url: "sendMail.php",
   data: $('#contactForm').serialize(),
   success: function(msg){
     $("#responseDiv").html(msg).show();
   }

});

当然,这是假设您的服务器使用“sendForm.php”发送 for 并且您的联系表单用

包装。以“contactForm”作为 id。
服务器应使用要在 div 中显示的文本进行响应。消息是否发送。

希望这有帮助。

参考:
jQuery 的 Ajax 帮助

First of all I don't believe you can notify the user that the mail was actually received (at least not in a trivial way). But you can notify that it was sent.
For this with jQuery you can send the contact info via AJAX and then show the response in the DIV.
May be something like this:

$.ajax({
   type: "POST",
   url: "sendMail.php",
   data: $('#contactForm').serialize(),
   success: function(msg){
     $("#responseDiv").html(msg).show();
   }

});

Of course this is assuming that your server sends the for with "sendForm.php" and that your contact form is wrapped with a <form> with "contactForm" as an id.
The server should respond with the text to show within the div. If the message was sent or not.

Hope this helps.

References:
Ajax help for jQuery

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文