Python 如何从django HttpResponse获取JSON?

Python 如何从django HttpResponse获取JSON?,python,django,json,httpresponse,Python,Django,Json,Httpresponse,我正在尝试从django HttpResponse获取json对象。实际访问“表单验证”值。但我不能。有什么建议吗 这是我的HttpResponse return HttpResponse(simplejson.dumps({'response_data':response_data, 'form_validation':form_validation, 'guest': guest, 'error_list':error_array}), mimetype="application/json"

我正在尝试从django HttpResponse获取json对象。实际访问“表单验证”值。但我不能。有什么建议吗

这是我的HttpResponse

return HttpResponse(simplejson.dumps({'response_data':response_data, 'form_validation':form_validation, 'guest': guest, 'error_list':error_array}), mimetype="application/json")

您需要为ajax调用定义
success
函数,该函数将包含json响应对象:

$.ajax({
        type: 'POST',
        url: url,
        data: {'csrfmiddlewaretoken': '{{csrf_token}}'},
        dataType: "text",
        success: function(response) {
            var response_data = response.response_data;
            var form_validation = response.form_validation;
            // access other fields
        },
        error: function(rs, e) {
            alert(rs.responseText);
        }
});

您如何尝试获取JSON对象?你在这方面收到了什么?HttpResponse看起来不错,请求是什么样子的?实际上我想在另一个函数中使用“form_validation”。我怎样才能得到它?