django ajax redirect to a view on success code example
Example: django ajax redirect to a view on success
$.post( "{% url 'your_url' %}",
{ csrfmiddlewaretoken: '{{ csrf_token}}' ,
other_params: JSON.stringify(whatever)
},
function(data) {
if(data.status == 1){ // meaning that everyhting went ok
// do something
window.location('your_url')
}
else{
alert(data.message)
// do your redirect
window.location('your_url')
}
});