Friday, March 31, 2017

Ajax Call is sending empty request.POST or request.body

Hi.

The difference is explained here:
https://docs.djangoproject.com/en/1.10/ref/request-response/

You are sending the data in the ajax call as Jason (I suppose, from the content type), then in your view you should probably use request.body to read the json document.

I also noticed you are using a django form. In that case you can change your ajax call to send a form encoding content type and serialize the html form as the data. In your view you can then use your django form to process the data from request.POST.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d30946f0-6403-4549-91e9-43536c129df1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment