1.后端如何得到前端數據
1)如果前端提交的方法為POST:
后端接收時要寫methods=[‘GET’,‘POST’]
xx=request.form.get(xx);
xx=request.form[’‘xx’]
2)如果是GET
xx=request.args.get(xx)
2.后端向前端傳數據
1) 傳單個數據`
return render_template(‘需要傳參網址’,xx=u’ xx’);
前端接收:
{{xx}}
2) 傳多個數據
先把數據寫進字典,字典整體傳
return render_template(‘需要傳參網址’,**字典名’);
前端接收:
{{字典名.變量名}}
關於web表單使用的:https://www.cnblogs.com/zheng1076/p/11307745.html