I'm successfully able to send the GET request, now I want to send the Post request. What modification should I make to send the id of the button when the button is pressed using a post request?
<HTML>
<head>
<script>
function fun1(element) {
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "/pre?"+element.id, true);
xhttp.send();
//alert(element.id);
}
</script>
</head>
<body>
<button type="button" onclick="fun1(this)" id="img1">IMAGE</button>
</body>
</html>