[Fixed]-Accepting django response with $.post

1👍

You don’t need an async POST here or the reload. The view is set up to respond with an HTTP 302 so it is already going to do another round trip to the server to load the redirect page.

Either use a simple form.submit() or if you want to do some processing to figure out what the POST variables and values should be then take a look at this SO question/answer.

0👍

In order for javascript to be able to read data sent from server in

success(function(data){

}

it must be in some form of exchangable format(xml,json).
I would recommend you to use DjangoRestFramework.
Check this page: http://www.django-rest-framework.org/tutorial/2-requests-and-responses/

Or you can just do something like this without need for rest framework:
Django view returning json without using template.

Leave a comment