Skip to content

Instantly share code, notes, and snippets.

@gpprojekt-marcin
Created June 17, 2015 09:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gpprojekt-marcin/25f51b0a70e8fe69cf20 to your computer and use it in GitHub Desktop.
Save gpprojekt-marcin/25f51b0a70e8fe69cf20 to your computer and use it in GitHub Desktop.
jQuery.ajax() download pdf
$.ajax({
url: url,
data: data,
success: function (data) {
var blob = new Blob([data]);
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = "Dossier.pdf";
link.click();
}
});
@imranmalik
Copy link

Thank you so much for this. You saved my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment