How to execute server-side code when clicking a button?

Then you’ll need to make an Ajax request to an endpoint that runs that code.

Can you say more about what you want to happen on the server side?