HTML post button

I need to use a button without using a form. How do I send a message to the browser?

I use:

<button style="height: 100px; width: 300px" onClick="parent.location='form1.php'" >Fill survey</button> 
+6
javascript html postdata
source share
1 answer

You will need to create the form in JavaScript and then submit it. Look at this code

HTML

 <button type="button" onclick="proceed();">do</button> 

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(); } 
+20
source share

All Articles