使用jQuery Validate插件submitHandler来触发fancybox窗口
我正在使用 jQuery 验证 & Fancybox 在网站上一起加载表单提交时的模式 Fancybox 窗口(经过 Validate 验证后)以确认订单正在处理,但遇到了一个我无法解决的奇怪问题。 << a>标签在与表单相同的页面上如下:
<a href="<?=ssl_url()?>basket/processing" class="processing" id="submit_holder">PROCESSING</a>
在 JS 文件中,我对 Fancybox 有以下配置:
$(".processing").fancybox({
'padding' : 0,
'width' : 400,
'height' : 400,
'modal' : true,
'overlayColor' : '#fff',
'overlayOpacity': 0.8,
'autoScale' : true,
'type' : 'iframe',
'transitionIn' : 'fade',
'transitionOut' : 'fade',
'titlePosition' : 'inside'
});
现在,直接单击此链接可以正常工作 - 按预期加载。当尝试通过 Validate 的submitHandler 启动时:
submitHandler: function(form) {
$('#submit_holder').click();
form.submit();
}
Fancybox 本身加载但完全空白。我无法查看任何源代码,也无法在新窗口中打开框架,这几乎就像 < 的 href 属性一样。 a> Fancybox 未将标记作为 iframe src 获取。
有人可以帮忙吗?这让我彻底抓狂。
谢谢,马特
I'm using jQuery Validate & Fancybox together on a website to load a modal Fancybox window on form submission (after being validated by Validate) to confirm an order is being processed but have encountered a weird issue I'm unable to resolve. The < a > tag is as follows on the same page as the form:
<a href="<?=ssl_url()?>basket/processing" class="processing" id="submit_holder">PROCESSING</a>
In the JS file I have the following config for Fancybox:
$(".processing").fancybox({
'padding' : 0,
'width' : 400,
'height' : 400,
'modal' : true,
'overlayColor' : '#fff',
'overlayOpacity': 0.8,
'autoScale' : true,
'type' : 'iframe',
'transitionIn' : 'fade',
'transitionOut' : 'fade',
'titlePosition' : 'inside'
});
Now, clicking this link directly works fine - loads as expected. When trying to launch via Validate's submitHandler:
submitHandler: function(form) {
$('#submit_holder').click();
form.submit();
}
The Fancybox itself loads but completely blank. I can't view any source nor can I open the frame in a new window, it's almost as if the href attribute of the < a> tag isn't being obtained as the iframe src by Fancybox.
Can anyone help? This is driving me completely nuts.
Thanks, Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过
$('#submit_holder').trigger('click');
而不是$('#submit_holder').click();
并尝试其他浏览器看看是否是浏览器问题。Have you tried
$('#submit_holder').trigger('click');
instead of$('#submit_holder').click();
and also try in other browsers to see if its a browser issue.