weixin_33686714 2015-10-28 15:14 采纳率: 0%
浏览 123

jBox ajax触发两次

I'm having a small problem with ajax requests being fired multiple times using the jBox tooltips jquery plugin.

I basically have a form setup within a tooltip displayed using ajax. The first time I submit the form (via ajax), it submits only once. However, if I close and open the tooltip multiple times and then submit the form again, it'll fire for as many times as I opened the tooltip.

How do you stop this?

This is my code to initiate the jBox tooltips:

var tooltip = new jBox('Tooltip', {
    attach: $('.tooltip'),
    onOpen: function(){
        // Get the ajax url if it's set
        if (this.source.data('ajax-url') != undefined) {
            this.options.ajax.url = this.source.data('ajax-url');
        } else {
            this.options.ajax.url = null;
        }
    },
    preventDefault: true,
    trigger: 'click',
    closeOnClick: 'body',
    width: 350,
    height: 'auto',
    zIndex: 1000,
    ajax: {
        reload: true,
        cache: false,
        setContent: true
    }
});
  • 写回答

1条回答 默认 最新

  • weixin_33720078 2015-11-04 16:03
    关注

    Okay, so I managed to fix this. It was because my ajax submit form code was in the ajax loaded template when it should have been within the main document.

    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置