I’ve been using the $.getJSON command for awhile. But since I’m actually posting to the server I need to be using $.post. But as soon as I switch from $.getJSON to $.post, the back end, which is the Flask Python framework, doesn’t seem receive any JSON data. That’s the only thing I changed. The documentation for $.post seems to indicate that the format is the same for sending data with either command.
With $.getJSON, I could access the JSON parameters in Flask with the request.args.get command. But after changing to $.post, request.args is empty (so request.args.get() always returns None). Here’s the line of javascript with $.getJSON:
$.getJSON("/admin/emails/ajax/send", {'data':JSON.stringify(data)}, function(){...})
And then just imagine that line with $.post(...) instead.
EDIT It appears that issue is when I change from ‘GET’ to ‘POST’, the data disappears from Flask’s request.args object. I tried using the $.ajax method and go the same results. Does anybody know why?
Just unwrap this beast and use $.ajax so you’re not tripping over wrappers.