Advice is simple: you cannot download files via AJAX – it’s a security policy. I mean you can download the data, but you can’t save it to disk from JavaScript side.
If you want to download a file on click, then you can just add href
to you a
tag. Or open a new window with file’s URL
.