In my javascript I have some information that I want to send to my flask code and return after some code has run.
In javascript I have the following code:
request.open('POST', '/update_price');
const data = new FormData();
data.append('sort', pizza);
data.append('toppings', amount)
request.send(data);
and flask:
@app.route('/update_price', methods=['POST'])
def update_price():
sort = request.form.get("sort")
toppings = request.form.get("toppings")
// run some code
return sort, toppings
How can I return sort and toppings to javascript? And do I send the data right in the first place?