I
I
Ivan Zhuravlev2020-04-13 19:27:16
Flask
Ivan Zhuravlev, 2020-04-13 19:27:16

How to send a POST request using AJAX and Flask MethodView?

Good day to all! I have a Flask application whose views are written using a class MethodViewfrom the flask.views. Most views are forms (used by Flask-WTF), so they have methods getand post. How can I rewrite the code so that the method postexecutes asynchronously using AJAX and does not freeze the page for the duration of the request? Is it even possible to do this using MethodView? All of the AJAX examples on the web use a more standard way of describing views: functions with a decorator @app.route.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question