Django Jquery Get Conf URL


Ok, so I'm trying to call the function

def user_timetable(request, userid):
    user = get_object_or_404(TwobooksUser,id = userid)
    timeSlots = TimeSlot.objects.filter(user = request.user)
    rawtimeslots = []
    for timeSlot in timeSlots:
        newSlot = {
            'startTime': str(timeSlot.startTime),
            'endTime': str(timeSlot.endTime),
    return HttpResponse(simplejson.dumps(rawtimeslots))

through the javascript in

{% include 'elements/header.html' %}

    <script type='text/javascript'>

        $(document).ready(function() {

            $.get('/books/personal{{ }}/timetable/', {}, function(data) {

                data = JSON.parse(data);
                var events = new Array();
                for (var i in data) {
                        id: data[i].id,
                        title: '{{ }}',
                        start: Date.parse(data[i].startTime, "yyyy-MM-dd HH:mm:ss"),
                        end: Date.parse(data[i].endTime, "yyyy-MM-dd HH:mm:ss"),
                        allDay: false

where the above exists in a template that's being rendered (I think correctly).

The url conf that calls the function user_timetable is


But, user_timetable isn't being called for some reason.

Can anyone help?

EDIT- Ok the original problem was that the template was not being rendered correctly, as the url in firebug comes to '/books/personalNone/timetable/' , which is incorrect.

I'm rendering the template like this -

def renderTimetableTemplate(request):
    #if request.POST['action'] == "personalTimetable":
    user = request.user
    return render_to_response(
        'user': user,
        context_instance = RequestContext(request)

Is there a mistake with this?

There is a slash missing after "personal"

  $.get('/books/personal{{ }}/timetable/', {}, function(data) {

should be

  $.get('/books/personal/{{ }}/timetable/', {}, function(data) {

Btw. you should use the {% url %} template tag.