【发布时间】:2012-10-12 18:26:28
【问题描述】:
我尝试使用 unique.submit 函数为页面上的所有表单提供相同的表单 ID 或单独的表单 ID。两者似乎都不起作用,总是只有第一个表格可以正常工作,其余的都会把我踢回主页。看我的代码。代码在只有一种表单的页面上效果很好,但是当我有多个表单时,它会导致问题。
$("#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;
});
});
我尝试使用所有表单 id's = sQuote 并将它们单独命名为 sQuote1 等...并为该唯一 ID 添加了另一个 .submit
【问题讨论】:
-
是否可以给每个表单一个唯一的ID并为每个表单ID添加上面的代码?
标签: php jquery html jquery-mobile