from django.shortcuts import render_to_response
from django.template import RequestContext
from models import Location

def view(request):
    locs = Location.objects.order_by(sortid)
if request.is_ajax():
    return render_to_response('object_list.html', {'object_list': locs},
        context_instance=RequestContext(request))
return render_to_response('base.html', {'object_list': locs},
    context_instance=RequestContext(request))
How to return json dictionary in django ajax update