javascript - 如何在没有提交按钮的情况下将页面值传递给其他页面
问题描述
该页面在 POST 的 infoCheck.php 上传递。
首先,我将继续如下。
<form id="theForm" method = "POST" action = "infoCheck.php"
<input type = "hidden" name = "name" value = "100">
<input type = "submit" value = "Input">
</form>
但是,在提交之前,只有与名称对应的值必须在页面打开时立即发送。一定有距离。即使我搜索了,我也只能看到如何使用提交......我该怎么办?
解决方案
如果你使用 jQuery,试试这个:
HTML
<form id="theForm" method="POST" action="infoCheck.php">
<input type="hidden" name="name" value="100">
<input type="submit" value="Input">
</form>
jQuery:
<script type="text/javascript">
$(function() {
$("#theForm").submit();
});
</script>
推荐阅读
- ios - 批量文件上传期间 SwiftUI 显示刷新进度
- rounding - 舍入同情表达式的一部分
- c# - 使用 SSH.NET 连接到 OpenSSH 7.4p1 失败并显示“服务器响应在位置包含空字符”但在 WinSCP 中有效
- bash - 检查 ksh 中存在的文件或目录(带空格)
- java - How JVM knows line numbers during runtime?
- kotlin - 使用 setOnItemClickListener 和 Intent 自定义 ListViewAdapter
- nginx - nginx如何返回动态URL地址
- css - 在 display:flex 容器内的顶部显示元素
- sql - Spring JPA 数据:查询 ElementCollection
- python - 如何在 django 中限制对外部 API 的调用