Facebox 窗口在提交后关闭

发布于 2024-08-26 16:19:03 字数 346 浏览 5 评论 0原文

我有一个关于 Facebox 的问题。当我单击页面上的某个链接时,Facebox 模式窗口会正常打开。但在这个模式窗口内,我希望有一个用户可以提交的表单。当用户单击提交按钮时,整个页面刷新,并且我的 Facebox 窗口关闭。这对我来说很有意义,但我希望它以不同的方式工作。

我想在用户提交表单后在模式窗口内向用户进行确认。因此,当用户单击提交按钮时,模式窗口内应显示确认信息。有人知道这是否可能吗?

我希望您能理解我的问题:)

谨致问候

Kim Andersen

I have a question regarding Facebox. When I click a certain link on my page, the Facebox modal window opens just fine. But inside this modal window I'd like to have a form that users can submit. When the users click the submit-button, the whole page refreshes, and my Facebox-window is closed. This makes sense to me, but I'd like it to work differently.

I want to give the user a confirmation, inside of the modal window, after they have submitted the form. So when a user clicks the submit-button, a confirmation should be showed inside og the modal-window. Anybody know if this is possible?

I hope that you understand my question :)

Best regards

Kim Andersen

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

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

发布评论

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

评论(2

心碎的声音 2024-09-02 16:19:03

您需要更改表单以使用 AJAX POST 而不是标准 HTML POST 请求。这是一个简单的教程,展示如何使用 jQuery 执行 AJAX 表单

You need to change your form to use AJAX POST instead of standard HTML POST request. Here's a simple tutorial that shows how to do AJAX form with jQuery.

自此以后,行同陌路 2024-09-02 16:19:03
  <form action='whateveryouhave.php' method='POST' id='myform' ><!--notice the form id-->
  <!-- your input and form stuff here just as you have it-->
  <a href='javascript:void(0);' onclick="submitFacebox">
  Submit in facebox instead of whole window
  </a>

  <script type='text/javascript'>
  function submitFacebox() {
      jQuery.post(jQuery('#myform').attr('action'), jQuery('#myform').serialize());
  }
  </script>
  <form action='whateveryouhave.php' method='POST' id='myform' ><!--notice the form id-->
  <!-- your input and form stuff here just as you have it-->
  <a href='javascript:void(0);' onclick="submitFacebox">
  Submit in facebox instead of whole window
  </a>

  <script type='text/javascript'>
  function submitFacebox() {
      jQuery.post(jQuery('#myform').attr('action'), jQuery('#myform').serialize());
  }
  </script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文