Hey,
I'm generating on-the-fly reports, and each report is displayed with a link "Export to excel". Every time this link is clicked, I use Ajax to export the data in the report's table and save it as a file (report.xls), then I use window.location = "report.xls " to force the user to open or save the report in excel format.
The report that's created on the server with the click is always accurate, but the one that the user can open/save is always a few reports old.
I figured it was a caching problem so I added the headers like:
header('Expires : Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: max-age=0');
header('Cache-Control: no-store, no-cache, must-revalidate');
I also changed from window.location ="report.xls " to document.locati on.href="report .xls". But no change.
Any ideas?
I'm generating on-the-fly reports, and each report is displayed with a link "Export to excel". Every time this link is clicked, I use Ajax to export the data in the report's table and save it as a file (report.xls), then I use window.location = "report.xls " to force the user to open or save the report in excel format.
The report that's created on the server with the click is always accurate, but the one that the user can open/save is always a few reports old.
I figured it was a caching problem so I added the headers like:
header('Expires : Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: max-age=0');
header('Cache-Control: no-store, no-cache, must-revalidate');
I also changed from window.location ="report.xls " to document.locati on.href="report .xls". But no change.
Any ideas?
Comment