2018-06-21 返回json格式的数据

def ajax_dict(request):

    name_dict = {'twz':'Love python and Django','zqxt':'I am teaching Django'}

    return HttpResponse(json.dumps(name_dict), content_type='application/json')


def ajax_dict(request):

    name_dict = {'twz':'Love python and Django','zqxt':'I am teaching Django'}

    return JsonResponse(name_dict)

你可能感兴趣的:(2018-06-21 返回json格式的数据)