I’ve been using window.open to point to a php file where I create a pdf on the fly using fpdf and display it immediately to the user. Seems to work fine across all browsers and even mobile devices. For example:
window.open('/client/feature_Schedule/scheduleReport.php','Schedule_Report','width=900,height=600,status=yes');
I’m not passing any values in this example because all of the parameters needed already exist in the php file.
But now I’d like to pass values from javascript along in order to query of the database in the php file before creating the pdf and displaying it to the user. Is there a convention I should be aware of? Window.open doesn’t seem to handle this except by adding the values after “?” at the end of the url. But I’d prefer to POST the values because there could be a lot of data being sent to the php file. I’ve even been playing around with $.ajax but am not sure how to trigger with pdf to open for the user.
Thanks.
There is a solution to send POST data with window.open() and it is quite simple:
Window.open and pass parameters by post method
It can even be made without any actual HTML code involved just with pure javascript programming.
// Edit: added javascript only solution: