I need to use a button without using a form. How do I make it send post data to the browser?
I am using:
<button style="height: 100px; width: 300px" onClick="parent.location='form1.php'" >Fill survey</button>
You'll need to create a form in JavaScript, then submit it. Look at this code
The HTML
<button type="button" onclick="proceed();">do</button>
The JavaScript code
function proceed () {
var form = document.createElement('form');
form.setAttribute('method', 'post');
form.setAttribute('action', 'http://google.com');
form.style.display = 'hidden';
document.body.appendChild(form)
form.submit();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With