Quiero enviar la identificación de un botón cuando se hace clic en él utilizando el método HTTP Post, he escrito el siguiente código. Pero el servidor no recibe la identificación del botón cuando presiono el botón. ¿Podría alguien por favor guiarme, lo que está yendo mal aquí? Gracias de antemano.
<HTML> <head> <script> function fun1(element) { var xhttp = new XMLHttpRequest(); xhttp.open("POST", "/prc", true); xhttp.send(element.id); //alert("ID":element.id); } </script> </head> <body> <button type="button" onclick="fun1(this)" id="img1">IMAGE</button> </body> </html>