gpt4 book ai didi

javascript - 表单无法从移动设备提交

转载 作者:行者123 更新时间:2023-12-02 21:03:45 25 4
gpt4 key购买 nike

我有一个表单,可以从台式机和笔记本电脑上正常提交,但从移动设备提交表单时数据不会传递。原因是需要将用户发送到调查页面而不是操作 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 时,表单会从移动设备发布。

最佳答案

您的表单标记有拼写错误。您拥有 id="sub"的 ID,并在 jquery 中调用 ID“sub_form”。

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

希望这对你有帮助:)

关于javascript - 表单无法从移动设备提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61275684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com