I used to use php to handle ajax request, which is pretty easy. Using Django framework is a little complex, here is a simple example, and I’m sure there are other ways.
1. In your views.py:
(1) include the following lines
from json import dumps from django.views.decorators.csrf import csrf_exempt