I try simulate post data within a form representing to:
<form id="new-order-form" action="https://sample.url" method="POST">
<input name="pId" type="text" value="pId" />
<input name="pPrice" type="text" value="pPrice" />
<input name="pWallet" type="text" value="pWallet" />
<input name="pAmount" type="text" value="pAmount" />
<button type="submit">send</button>
</form>
Unfortunately, I cannot simulate it with the redirect also.
I try:
<form id="new-order-form" :action="payUrl" method="POST">
<input name="pId" type="text" :value="pId" />
<input name="pPrice" type="text" :value="pPrice" />
<input name="pWallet" type="text" :value="pWallet" />
<input name="pAmount" type="text" :value="pAmount" />
<button type="submit">send</button>
</form>
Then assign values and triggering with jQuery: $('#new-order-form').submit()
Second option is with formData
, but I cannot be redirected.
I try:
var formData = new FormData()
formData.append('pId', this.identification)
formData.append('pPrice', this.price)
formData.append('pWallet', this.ethWallet)
formData.append('pAmount', this.investAmount)
this.$http.post(this.payUrl, formData)
What is the most effective way? Which can simulate the POST form in the closest way?