我在尝试向其提交数据的远程服务器上有一个表单,示例如下
<html>
<head>
</head>
<form action="http://www.example.com/post.php" method="post">
<input type="text" name="input1" value="test1" />
<input type="text" name="input2" value="test2" />
<input type="submit" name="send" value="Submit" />
</form>
</body>
</html>
我正在尝试像这样自动提交数据
<html>
<head>
</head>
<form action="http://www.example.com/post.php" method="post">
<input type="text" name="input1" value="test1" />
<input type="text" name="input2" value="test2" />
<script type="text/javascript">
document.forms[0].submit();
</script>
</form>
</body>
</html>
如果第一个示例没有 (name="send") 名称,但它确实有名称,则它可以正常工作。我的问题是我将如何使用具有名称的输入按钮发送数据。
谢谢