So I am doing something with my Arduino Uno where when a button is clicked on my webserver the URL appends '?feed' to the end of it (but is still the same current page). This is absolutely necessary for my Arduino sketch because this is when it knows to rotate my servo.
ANYWAYS. However, I want underneath the button to display the date it was clicked. The problem with this is when the button is clicked, it shows the date for a split second and then reloads the page to append to the URL.
HTML & Javascript (sorry if it's sloppy):
<a href="?feed"><button onclick="displayDate()">FEED ME!</button></a>
<script>
function displayDate() {
document.getElementById("demo").innerHTML = Date();
}
</script>
<p id="demo"></p>
buttoncan not be inside ana, that’s invalid HTML.