Fancybox 对话框点击
我有一个页面,用户可以从中提交简短的表格来请求报价。我不想丢失页面上下文,因此我想在对话框窗口中打开该表单并允许他们从那里提交。这一切都有效,但我在 iframe 和 ajax 实现方面都遇到问题。具体来说:
- 我无法让 iframe 实现调整其内容大小。
- 我无法让 ajax 实现在对话框内提交表单。
提交表单后,我希望对话框保持打开状态,以便我可以向用户显示任何表单错误或感谢/成功消息。然后他们就可以重新提交或关闭对话框。
我一直无法找到一种方法来完成这项工作。我并不特别关心我使用哪种实现,但我需要良好的用户体验。有什么想法吗?
I have a page from which a user can submit a short form requesting a quote. I don't want to lose the page context, so I'd like to open that form in a dialog window and allow them to submit from there. This all kind of works, but I'm having problems with both the iframe and ajax implementations. Specifically:
- I can't get the iframe implementation to resize to its content.
- I can't get the ajax implementation to submit the form within the dialog.
When the form is submitted, I want the dialog to remain open so that I can display any form errors or a thank you/success message for the user. They would then be able to resubmit or close the dialog.
I haven't been able to find a way to make this work. I don't particularly care which implementation I use, but I need the user experience to be decent. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用此处记录的公共方法
$.fancybox.resize
。在 FancyBox 内提交表单可以通过不同的方式完成。我个人更喜欢使用 AJAX 提交并使用回调显示结果。 这是一个示例:
You can use the public method
$.fancybox.resize
, documented here.Submitting the form inside the FancyBox can be done in different ways. I personally prefer to do an AJAX submission and display the results using a callback. Here's an example: