How do I send empty response in Django without templates

render_to_response is a shortcut specifically for rendering a template. If you don’t want to do that, just return an empty HttpResponse:

 from django.http import HttpResponse
 return HttpResponse('')

However, in this circumstance I wouldn’t do that – you’re signalling to the AJAX that there was an error, so you should return an error response, possibly code 400 – which you can do by using HttpResponseBadRequest instead.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)