doukeyong3746487 2012-10-12 18:26
浏览 148

JQuery Mobile,页面上的多个表单,通过表单ID通过JQuery Post提交唯一表单。

I tried giving all the forms on the page the same form id or individual form id's with a unique.submit function. Neither seemed to work, always only the first form would work all the rest, would just kick me back to the homepage. see my code. code works great on pages with just one form, but when I have multiples it causes problems.

$("#sQuote").submit(function() {
                //Send the serialized data to mailer.php.
                $.post("mailerS.php", $("#sQuote").serialize(),
                    //Take our repsonse, and replace whatever is in the "formResponse"
                    //div with it.

                    function(data) {
                    $("#sQuote").html( $("#formResponse").html() );
                    }
                );
                return false;
            });

        });

I tried this with all the form id's = sQuote and the named them individually sQuote1 ect... and added another .submit for that unique ID

  • 写回答

1条回答 默认 最新

  • douwu0882 2012-10-12 18:45
    关注

    For what it's worth, on every single page all used id attributes have to be unique. Having more than one id attribute with the same value will lead to all kind of failure.

    Validate your document with the W3 validator and fix the errors as a start. Duplicate ids will be reported as errors there.

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料