有没有办法得到一个fancybox(
http://fancy.klade.lv/)或任何
其他灯箱提交一个FORM(带图像按钮)?
其他灯箱提交一个FORM(带图像按钮)?
HTML看起来像这样:
- <form action="/ACTION/FastFindObj" method="post">
- <input name="fastfind" class="fastfind" value="3463" type="text">
- <input name="weiter" type="submit">
- </form>
这些不会做:
解决方法
我相信所有其他答案都错过了这个问题(除非我是一个误会)。我认为作者想要的是让表单提交时,其结果显示在一个fancybox中。我没有发现任何其他答案提供了这个功能。
为了实现这一点,我使用jQuery Form Plugin(http://malsup.com/jquery/form/)来轻松地将表单转换成ajax调用。然后我使用成功回调通过手动调用$ .fancybox()将响应加载到fancybox中。
- $(document).ready(function() {
- $("#myForm").ajaxForm({
- success: function(responseText){
- $.fancybox({
- 'content' : responseText
- });
- }
- });
- });