how can I use data posted from ajax in flask?

后端 未结 4 1344
后悔当初
后悔当初 2020-11-28 02:30

I\'m having trouble getting data POSTed from jquery ajax.

$(\'#clickme\').click( function() {
    var data = save_input(); // data

    data[\'_sid\'] = $sur         


        
4条回答
  •  悲&欢浪女
    2020-11-28 02:50

    On the flask side, use:

    data = request.get_json()
    

    The variable data now has the dictionary you sent using ajax and you can now manipulate it with python

提交回复
热议问题