I’m generating an HTML page via Python, using the Flask framework to receive messages and the requests module to send them. My python script has a global list variable called History, and when a button is clicked I want the python script to run the command History = [] (e.g. dump the contents of the list).
How do i achieve that? I generated the button with the following code :
s += '<input type="submit" value="Reset History">'
return s
But right now it does nothing.
Have the HTML page send a value using either POST or GET, which is then picked up by a cgi form in Python, converted to integer, and
Or you could use AJAX to send the request, instead of loading a new page. see
xmlHttpRequest()