I am newbie to DRF and Ajax, my serializer code class CartItem(models.Model): cart_id = models.CharField('Cart ID', max_length=50) shop = models.ForeignKey(Shop) date
Solution 1:
HTTP 400 is Bad Request which means that Django is unable to understand the request.
Try adding:
dataType: "json",
contentType: "application/json"
Now Django will know that you are posting json
This is what you are looking for.
Share
Post a Comment
for "Django Rest: Ajax Post Is Not Working, 400 Response"
Post a Comment for "Django Rest: Ajax Post Is Not Working, 400 Response"