def get_items(request):
    return {}

@view_config(route_name='name', permission='perm', xhr=True, renderer='json')
def r_ajax(request):
    items = get_items(request)
return {'data1': 1, 'data2': 2, 'data3': 3, 'html': renderers.render(
    'shortr.mako', {'items': items}, request)}

@view_config(route_name='name', permission='perm', renderer='r.mako')
def r_html(request):
    items = get_items(request)
return items
A better pattern for ajax loading with pyramid?