I have a php script that gets called via an ajax call. Values are sent to this script to build a pdf. I want to send the pdf to the browser, but since the script that builds the pdf returns to the page with the javascript I can’t see how to do this. Any ideas?
Share
I would recommend something a bit different. Instead of AJAX call make a redirect to an URL like this:
This script would be the one which generated the pdf. Place somewhere on top of the script this header:
And simply
echothe string the pdf content is in. If you want the user to download this pdf instead of viewing you could do the AJAX call with the example found HERE: