[Answer]-Make redirect url work with ajax

1👍

The view is not the one that should redirect in case of an ajax request. Rather make the view return the success_url to the ajax call and then use the success callback to re-direct the user.

Example with jquery

$.ajax(url, data, function (data, response, xhr){
    ...
    var url = success_url; //Get success url from your data which is a json response object   
    $(location).attr('href',url);
});

You can do redirection without jquery as well, see
How to redirect to another webpage in JavaScript/jQuery?

Leave a comment