I have implemented the following code:
I have an html button like this:
HTML
<button style="background-color: #f39900;" onclick="downCont()"> Download all content </button> The downCont() function invoked on click is an ajax POST like this:
JQuery
var downCont = function() { $.ajax({ method: "POST", contentType: "application/x-www-form-urlencoded", url: "<endpoint here>", data: { "tokenId": token, "downloadId": "cz98567354", "saveAs": "AllContents" } }) .done(function() { alert("I have downloaded all contents!"); }); }); Now, the response of this POST request is used to download an archive of images which is streamed directly to the user (content-type: application/octet-stream). How can I trigger the download of the archive by the browser itself using jQuery?