[Answer]-Django flatten dictionaries in ajax get / post

1👍

What content-type are you sending to the django server?
It should be set to : ‘application/json’ so the server knows it is receiving json.
Also, try to retrieve the data with request.data instead of data.post.
You should then be able to do the following:

if (request.data):
   payload = request.data['payload']

Quick note, if thats all you are passing to the server i would remove one level and only send the inner dictionnary like so :

{'website':'localhost.com'}

and then retrieve it with

request.data['website']

Leave a comment