简体   繁体   中英

Flask - Send Javascript Variable to Python

I'm looking for a simple Flask example that demonstrates pressing a button in an HTML page that sends a Javascript string variable to Flask in Python and then prints that string to the terminal where the app is running.

Flask RESTful API. It's not that easy as you might think. You have to set up basic Flask RESTful API for this and make post requests from the JS code, passing the variable as a parameter. For the Flask side you will be good off with this Flask RESTful documentation And for the frontend you want to use something like Axios or similar things

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM