Hi,
I'm trying to figure out how to pass html back to a jQuery call, but for some reason my code refuses to work.
t = get_template('success.html')
html = t.render(Context({'success': True})) # should render '<p><h1>aoeu</h1></p>'
x = "{'success' : '" + html + "'}"
return HttpResponse(x)
jQuery code:
$.post("adduser", data, function(responseData){
$('#content').html(responseData.success);
}, "json");
if I replace html with a literal string (just 'asdf' or something), #content changes correctly. If I use the rendered html, it doesn't show. What am I doing wrong? Also, is this the correct way to make a dynamic call with django?