0

I'm new for flask and HTML. I want an application that each time I click a button, the web can request data from the dataset in flask. For example, there is a dataset in flask like

[{'col0': 0,'col1': 0,'col2': 0},{'col0': 1,'col1': 1,'col2': 1},{'col0': 2,'col1': 2,'col2': 2},{'col0': 3,'col1': 3,'col2': 3}]

I want to make a button such that every time I click the button, the web can extract two dicts in the dataset and append them in the table in HTML. What should I do? Sorry I don't have codes now because I don't where to start. Thanks.

plxpx
  • 1
  • 1
  • Welcome to SO, and welcome to the Flask world too. Can you share the code you have tried, what you got stuck with or the error you are facing? – shoaib30 Aug 05 '21 at 07:08
  • Sorry I don't have codes now because I don't where to start . – plxpx Aug 05 '21 at 07:11
  • 1
    I would recommend going through the [Tutorial on Flask](https://flask.palletsprojects.com/en/2.0.x/tutorial/), that's where I started. It may not answer your question right away but I can assure you that you'll know how to do what your require by the end of the tutorial! – shoaib30 Aug 05 '21 at 07:13
  • 1
    From your browser-side/frontend codes, you need to make a GET request to your server-side/backend Flask app, handle that request, and send back a response, and render in HTML. You can use Flask templates to create your frontend or learn any of the popular frontend (JS) frameworks. – Gino Mempin Aug 05 '21 at 07:21
  • Here is one of the results after searching with the keywords in my previous comment: [Flask - Calling python function on button OnClick event](https://stackoverflow.com/q/42601478/2745495) – Gino Mempin Aug 05 '21 at 07:23

0 Answers0