How can I automatically download a file after an AJAX call? Now my AJAX call is redirecting me to the resource, but not downloading the file.
this is my AJAX call:
$('.download').click(function (e) {
    e.preventDefault();
    let videoId = $('#video').data('video-id');
    $.ajax({
        url: "/video/" + videoId + "/download-link",
        type: "GET",
        success: function (response) {
            window.location = response.link;
        }
    });
});
And this is the html tag:
<a href="#" class="download">
     <i class="fas fa-long-arrow-alt-down"></i>Download
</a>
 
     
    