[Answer]-How to use AJAX post in django

1👍

Views must always return an HttpResponse object. You need to wrap your data in that.

return HttpResponse(2)

For more complex data, serialize to JSON before creating the response – in 1.7, there is a JsonResponse class to do that for you.

Leave a comment