Change value from DB after click

Hello)
How, when you click on a button in a template, change the value of the DB field and display the changed result in the same template. An important point is that everything happens in the same template.How to do this?