Created
July 6, 2012 16:25
-
-
Save mrchilds/3061165 to your computer and use it in GitHub Desktop.
Django - basic ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpResponse | |
from django.template.loader import render_to_string | |
from django.utils import simplejson | |
def myajax(request): | |
#Some logic | |
html = render_to_string(TEMPLATE, context) | |
return HttpResponse(simplejson.dumps({"html": html}), | |
content_type="application/json; charset=utf-8") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment