$.get(
url: downloadUrl,
function(data) {
//after get the data, how to ask browser pop up to save file?
}
);
data is content dumped by server side servlet. can be binary
Downloading PDF File on Button Click using jQueryInside the DownloadFile JavaScript function, the URL of the File is passed as parameter to the jQuery AJAX function. Inside the jQuery AJAX function, using the XmlHttpRequest (XHR) call, the PDF file is downloaded as Byte Array (Binary Data).
Don't use Ajax for this, just location = downloadUrl;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With