0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Flask メモ 2

Posted at

ブラウザー側から配列をもらいたい

##.ajax()

bad request 400 と苦戦した結果

JavaScript側


$("#finish").on('click',function(){
        $.ajax({
            url:"/finish",
            type:"POST",
            data:JSON.stringify(arrObj(action)),
            contentType: "application/json; charset=utf-8",            
            dataType: "json",
            traditional: true,

            success:function(){
                console.log(sent);
            },

            error:function(){
                console.log(err);
            }
        })
    });

Python側


@app.route('/finish',methods=['POST'])
def getData():
    if request.method == 'POST':
        data = request.get_json(force=True)
        print(data)

    return render_template("result.html")

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?