【发布时间】: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