Save click in table

I have a button that toggles the display of a hidden div:

echo '<button class="button0" onclick="showDiv(this.value)" value="itemInfo' . $counterz . '">Item Info</button>'; 

Is there a simpler way to save that button click to a table than using an ajax call? If so, how would you do it?

Ajax allows you to communicate with the web server without needing to reload the page.

Simpler ways involve reloading the page. Is that what you’re willing to live with?