I am trying to pass data via ajax POST to current py api but always get ImmytableMultiDict<[]>
when try to print passed values.
Here is the code:
@app.route('/users/new', methods=['POST'])
@handle_exceptions_in_web_views
def intromeeting():
print(request.args)
firstname, lastname = parse_user_request_args(request.args)
def parse_user_request_args(args):
firstname = args.get('firstName') or ''
lastname = args.get('lastName') or ''
return firstname, lastname
js code:
$.post('users/new', {
firstName: 'test first name',
lastName: 'test last name'
}).done(function(res){
console.log(res)
}).fail(function (err){
console.log(err)
});
I also tried to use $.ajax
but got the same result. Should I move data to form or smth ?