I run the following code from within my HTML page with Javascript:
$.post(url,{'key':'Value'})
The Python Flask code looks like this:
@main.route('/documents', methods=['GET', 'POST'])
def documents():
if request.method == 'POST':
print "Post Recieved"
jsData = request.get_json(force=True)
print 'data: ', jsData
return "<html>Post Recieved</html>"
The output looks like this:
>>Post Received
>>
I find this odd because I should see the console print a 'data: Something' or an error.
When I change the the code to include the following:
jsData = request.get_json(force=False)
I get the following output:
>>Post Received
>>data: None
In this case 'None' refers to a python 'NoneType'.
Bottom line is that I'm having trouble posting the JSON to Python Flask and making the JSON accessible from within Flask. Any help would be appreciated.