Fetch Data
Terms defined: HTTP GET, HTTP request, JavaScript Object Notation (JSON), route (in server)
server.py
: page initially has button and emptydiv
- When button clicked, JavaScript in
static/dashboard.js
sends aGET
request to a new route in the Flask server- An asynchronous function
- Response is JSON containing HTML string representation of table
- Have to do some substring operations to extract it from what the dataframe generates
- Assign that string to the inner HTML of the
div
Run
python server.py --seed 12345
- Go to http://127.0.0.1/5000
- Click the button to fetch and display HTML