将数据从JavaScript传递到Flask [英] Passing data from javascript into Flask
问题描述
我知道如何将数据从python的jinja模板传递到javascript,但我想传递一个JavaScript变量到python。我想这样做,而无需重新加载页面。是否有可能?
是的,像monkut说的 - 我相信你要使用JSON和Javascript / jQuery。 p>
这将允许从客户端到服务器的通信并返回。
我发现的最适用的例子是Flask片段/模式: http://flask.pocoo.org/docs/patterns/jquery/
I know how to pass data with a jinja template from python into javascript, but I want to pass a javascript variable into python. I'd like to do it without reloading the page. Is that possible?
Yes, like monkut said--I believe you want to use JSON and Javascript/jQuery.
This will let allow communication from client to server and back again.
The most applicable example I found was in the Flask snippets/patterns: http://flask.pocoo.org/docs/patterns/jquery/
这篇关于将数据从JavaScript传递到Flask的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!