使用jQuery Validate插件submitHandler来触发fancybox窗口

发布于 2024-09-10 08:04:55 字数 1024 浏览 1 评论 0原文

我正在使用 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 技术交流群。

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

发布评论

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

评论(1

尘世孤行 2024-09-17 08:04:55

您是否尝试过 $('#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.

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