I have a php script that zips up a series of files after a user selects them from a list. I'm currently making an ajax call to this script, and am passing it a series of urls that should be zipped. I would for this zip file to be downloaded automatically when its finished being zipped, and am having trouble figuring out how to do this. What would be the best way to force download this zip file after its finished, assuming i'm passing the url of the zip from my php file back to my js file?
Thanks
Have you tried:
success: function(resp) {
window.location.href = resp;
}
That assumes that the response is the filename as a string.
window.location=zipfilePath;
The browser will try to switch to the provided URL, recognize that it's not a webpage, stay on the old page and download the zipfile.
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