I use Django\'s built-in DeleteView and I\'ve assigned a value to the success_url attribute. Now in my template, I trigger this view via JQuery\' $.post() metho
http://hunterford.me/how-to-handle-http-redirects-with--jquery-and-django/
Edit: source unavailable
this one works for me, perhaps looks like hack
django middleware
from django.http import HttpResponseRedirect
class AjaxRedirect(object):
def process_response(self, request, response):
if request.is_ajax():
if type(response) == HttpResponseRedirect:
response.status_code = 278
return response
javascript
$(document).ready(function() {
$(document).ajaxComplete(function(e, xhr, settings) {
if (xhr.status == 278) {
window.location.href = xhr.getResponseHeader("Location");
}
});
});