应用名/views.py(视图,视图函数,返回Json数据,JsonResponse):
from django.shortcuts import render
from django.http import JsonResponse
# 视图函数,返回Json数据。
def ajax_handle(request):
'''ajax请求处理'''
# 返回的json数据 {'res':1}
return JsonResponse({'res':1}) # 通过JsonResponse对象返回Json数据。