Flask cannot get ajax send post data

flask cannot get ajax send post data
var data1= {

  "name":"kikay",

}
var data = JSON.stringify (data1)
ajax ("POST"," http://localhost:5000/login",null, data1, function (r) {
console.log (data,r.status,r.response)
})
send ajax
@ app.route (" / login",methods= ["POST"])
def login ():

-sharpPOST
name=request.form.get("name")
print name
-sharp
if name=="kikay" :
    print "dd"
    return jsonify("kikay")
else:
    print name
    return jsonify("error")
 flask error
Mar.13,2021
The data parameter of

ajax should be of dictionary type, and there is no need for stringify, to delete the sentence (var data = JSON.stringify (data1).

Menu