سؤال

I have a php script that generate a pdf file. So I have an html page with jquery javascript that do an ajax call at this php script and retrieve the pdf file content. I would that this file will be saved in a location choosed by a save file dialog.

How can I do it?

Thank you so much.

هل كانت مفيدة؟

المحلول

You don't need Ajax - just do a

location.href = "fileURL.php";

(or alternatively, have the user click on a link) and if the headers are set correctly, a download dialog will present itself.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top