With Flask and JQuery, how to delete a record by "POST" method in "sexy" way? With Flask and JQuery, how to delete a record by "POST" method in "sexy" way? flask flask

With Flask and JQuery, how to delete a record by "POST" method in "sexy" way?


Actually you don't need to send full page in return to DELETE request. Empty HTTP 204 response is the standard return value for such request:

def delete_article_category(id):    deleting_article_category = ArticleCategory.get(ArticleCategory.id == id)    deleting_article_category.delete_instance()    return Response(status=204)

You don't need to worry about refreshing page as all static files are got by browser from its cache. Unless you use location.reload(true), of course. Check the logs of your application: most probably it serves static files with HTTP 304 code (Not Modified) like this:

127.0.0.1 - - [16/Mar/2017 10:10:10] "GET /static/admin/bootstrap/bootstrap3/css/bootstrap.min.css?v=3.3.5 HTTP/1.1" 304 -