【问题标题】:Form does not submit from mobile devices表格不从移动设备提交
【发布时间】:2026-02-16 19:30:01
【问题描述】:

我有一个可以从台式机和笔记本电脑提交的表单,但是从移动设备提交表单时数据没有通过。原因是需要将用户发送到调查页面而不是操作 URL,这对于我们的营销自动化平台来说是不可避免的。

这是我的表格:

<iframe name="submitFrame" id="submitFrame" width="0" height="0" style="display:none;"></iframe>
<form id="sub" name="sub" action="https://123.xxxxxxxxx.com/e/f2" method="post" target="submitFrame">

这是表单处理程序:

jQuery("#sub_form").submit(function(event) {
    var form_cat = (new URL(location)).searchParams.get('cat')
    jQuery('input[name="catNumber"]').val(form_cat);  
    window.location.replace("https://testing.com/survey");

更新:当我注释掉 window.location.replace 时,表单会从移动设备发布。

【问题讨论】:

    标签: javascript jquery forms form-submit


    【解决方案1】:

    您在表单标签中有错字。您拥有 id="sub" 的 ID 和在 jquery 中调用 ID“sub_form”的 ID。

    你可以在 div 标签中为 sub_form 更改 id,反之亦然,我的意思是在 jquery 中将其更改为 sub

    希望对你有帮助:)

    【讨论】:

      最近更新 更多