I have a Flask application, and in my html template (which is Jinja2) I have a simple form which has only a button:
<form name='resetLayoutForm' method='POST'>
<input type="submit" value="Reset layout" class="submitButton"/>
</form>
@app.route('/localhost/some_route', methods = ['POST', 'GET'])
def function():
. . .
if request.method == 'POST':
# code
. . .
Duplicate the form that contains the button and set it's action to a different URL. Then, when pressed, only that different URL will receive the data.
Obviously, as others have noted, there are Javascript mechanisms to achieve this but if those are not needed...