What is the best way to update my website with user input (GET/POST requests and Python backend)?

What is the best way to update my website with user input (GET/POST requests and Python backend)?
0

I am trying to create a site that displays data and having the user “filter out” the entries displayed by selecting several options.
I am really new to working with a backend and with requests.
My backend is Python and my frontend is JS/JQuery and HTML

My plan is to

  1. Send a POST request from Javascript with the value the user inputs (or selects from a dropdown menu)
  2. Python should receive the request, perform an operation, and update the data.
  3. Show updated data on Javascript.

My question is, can I send the updated data in the response of the POST request, or should I make a GET request after the POST request?

My personal preference is to return the updated/new entity as part of a POST/PUT response. There is precedent for doing it either way, but returning the entity makes things a lot simpler. If you never need the updated/new entity (say you’re posting to some flavor of logger) then obviously it makes no sense to return an entity.

1 Like