在Django中使用JSONText

I'm using JSONText to load a JSON call in my Jquery but for some reason the request is failing,

Here is the code, urls.py

urlpatterns = patterns('',
#JSON Response
    (r'^json/$', json_request)
)

views.py

from django.utils import simplejson

def json_view(request):
    print 'json_view being called'
    to_json = {
        "key1": "value1",
        "key2": "value2",
        "key3": "value3",
        "key4": "value4"
    }
    return HttpResponse(simplejson.dumps(to_json), mimetype='application/json')


def json_request(request):
    variables = RequestContext(request)
    return render_to_response('ajaxtest.html',variables)

ajaxtext.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style>
    #mainViewContainer{
        background-color:red;
        height:100px;
        width:200px
    }
</style>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
    var main_container = $("<div>").attr("id", "mainViewContainer");
    main_container.append($('<div id="table_layout" />')
            .append($('<table id="table_set"/>').
                    append('<thead><tr> <th>ID</th><th>Name</th> <th>DOB</th>  <th>Date Enrolled</th>   </tr></thead>')));


    $.getJSON("/json_view",function(census_data){
        $(census_data).each(function(k,v){
            $('#table_set').append();
            trObj = $('<tr>');
            trObj.append($('<td>').html(v.key1));
            trObj.append($('<td>').html(v.key2));
            trObj.append($('<td>').html(v.key3));
            trObj.append($('<td>').html(v.key4));
            $('#table_set').append(trObj);
        });

    main_container.appendTo(document.body)
});
</script>
</head>
<body>
</body>
</html>

You don't have a route for json_view in your urls.py. Try to add one:

urlpatterns = patterns('',
#JSON Response
    (r'^json/$', json_request)
    (r'^json_view/$', json_view)
)

(note the slash at the end of ^json_view/)