How can I send a post form without click submit button?

1.8k views Asked by At

For example below code, I have to click on submit button to go to the destination post page, but I want to go to the destination page without click on the submit button, and I want to go to the destination page with click on the button in my telegram bot an run my code page.

<html>
<body>
<form action="?????????" method="post" target="_blank">
  type: <input type="text" name="type" value="111" ><br>
  amount: <input type="text" name="amount"value="1000"><br>
  cellphone: <input type="text" name="cellphone"value="2222"><br>
  email: <input type="text" name="email"value="[email protected]"><br>
  webserviceId: <input type="text" name="webserviceId"value="34433"><br>
  redirectUrl: <input type="text" name="redirectUrl"value="w2323.php"><br>
  issuer: <input type="text" name="issuer"value="ssdsd"><br>
  redirectToPage: <input type="text" name="redirectToPage"value="True"><br>
  scriptVersion: <input type="text" name="scriptVersion"value="Script"><br>
  firstOutputType: <input type="text" name="firstOutputType"value="get"><br>
  secondOutputType: <input type="text" name="secondOutputType"value="get"><br>
  <input type="submit" value="submit">
</form>
</body>
</html>
1

There are 1 answers

0
ka_lin On

Add an id to the form, then bind a function on a button. Although your question is a bit unclear on what you want exactly

<form id='someid'>

    type: <input type="text" name="type" value="111" ><br>
    amount: <input type="text" name="amount" value="1000"><br>
    cellphone: <input type="text" name="cellphone" value="2222"><br>
    email: <input type="text" name="email" value="[email protected]"><br>
    webserviceId: <input type="text" name="webserviceId" value="34433"><br>
    redirectUrl: <input type="text" name="redirectUrl" value="w2323.php"><br>
    issuer: <input type="text" name="issuer" value="ssdsd"><br>
    redirectToPage: <input type="text" name="redirectToPage" value="True"><br>
    scriptVersion: <input type="text" name="scriptVersion" value="Script"><br>
    firstOutputType: <input type="text" name="firstOutputType" value="get"><br>
    secondOutputType: <input type="text" name="secondOutputType" value="get"><br>
    <button onclick="myFunc()">

</form>

JS

function myFunc() {

    document.getElementById("someid").submit();

}