The following code in one of my views returns unescaped html string which cannot be parsed in frontend since it is an Ajax request.
return render_to_response
Lakshman Prasad's answer is technically correct, but a bit cumbersome. A better way to escape text would be (as suggested in a comment by miku above):
from django.utils.html import escape return HttpResponse(escape(some_string))