大佬教程收集整理的这篇文章主要介绍了jquery – 如何从AJAX帖子中获取Flask中的数据,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
$(document).ready(function(){ var clicked; $(".favorite").click(function(){ clicked = $(this).attr("name"); $.ajax({ type : 'POST',url : "{{url_for('test')}}",data : clicked }); }); });
瓶/ Python的
@app.route('/test/',methods=['GET','POST']) def test(): return render_template('test.html')
$(document).ready(function(){ var clicked; $(".favorite").click(function(){ clicked = $(this).attr("name"); $.ajax({ type : 'POST',contentType: 'application/json;charset=UTF-8',data : {'data':clickeD} }); }); });
在您的烧瓶端点中,您可以按如下方式提取值:
@app.route('/test/','POST']) def test(): clicked=None if request.method == "POST": clicked=request.json['data'] return render_template('test.html')
以上是大佬教程为你收集整理的jquery – 如何从AJAX帖子中获取Flask中的数据全部内容,希望文章能够帮你解决jquery – 如何从AJAX帖子中获取Flask中的数据所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。