radi8 Posted January 20, 2011 Share Posted January 20, 2011 I have a script that will export data to excel. After the export, I need the page to reload showing status information, but it does not reload. What could be causing an issue like this? I think that because the export forced the download file dialogue to open, those headers may be preventing the form from reloading properly, but how, why, and what can be done to resolve the issue? Quote Link to comment https://forums.phpfreaks.com/topic/225098-exporting-data-to-excel-prevents-page-refresh/ Share on other sites More sharing options...
QuickOldCar Posted January 20, 2011 Share Posted January 20, 2011 Maybe try to target the download a new window and force close window with javascript when completed. Quote Link to comment https://forums.phpfreaks.com/topic/225098-exporting-data-to-excel-prevents-page-refresh/#findComment-1162610 Share on other sites More sharing options...
radi8 Posted January 20, 2011 Author Share Posted January 20, 2011 You know, I have tried many many things, but this may just work. Thanks, I will give it a shot. Quote Link to comment https://forums.phpfreaks.com/topic/225098-exporting-data-to-excel-prevents-page-refresh/#findComment-1162623 Share on other sites More sharing options...
radi8 Posted January 20, 2011 Author Share Posted January 20, 2011 Hey all stupid question. I am going to try the javascript thing to close the browser when the Export is completed. But, can someone give me an idea on how to force the javascript to fire AFTER the download is complete? Any help is appreciated. Here is my basic structure of the new mover.html.php page: <?php //session_start(); include_once $_SERVER['DOCUMENT_ROOT'] .'/inc/standardFunctions.inc.php'; //phpinfo(); $dodebug=1; if($dodebug > 0) { ini_set ("display_errors", "1"); //error_reporting(E_ALL); error_reporting(-1); echo "<pre>"; switch($dodebug) { case 1: echo "--> Form data (POST) <-- <br>"; print_r ($_POST); echo "--> Form data (GET) <-- <br>"; print_r ($_GET); echo "--> Header List <-- <br>"; //var_dump(headers_list()); print_r(headers_list()); break; case 2: echo "--> Form data (POST) <-- <br>"; print_r ($_POST); echo "--> Form data (GET) <-- <br>"; print_r ($_GET); echo "--> Form data (SESSION) <-- <br>"; print_r ($_SESSION); break; case 3: echo "--> Form data (POST) <-- <br>"; print_r ($_POST); echo "--> Form data (GET) <-- <br>"; print_r ($_GET); echo "--> Form data (SESSION) <-- <br>"; print_r ($_SESSION); echo "--> Form data (SERVER) <-- <br>"; print_r ($_SERVER); break; case 4: echo "--> PHP Info <-- <br>"; phpinfo(); default: echo "--> Form data (POST) <-- <br>"; print_r ($_POST); break; } echo "</pre>"; } else { ini_set ("display_errors", "0"); error_reporting(0); } ?> <html> <head> </head> <?php $process = $_GET['process']; if(isset($_GET['cname']))$cname=$_GET['cname']; else $cname=''; switch ($process) { case 1: exportTruckingCompanies(); break; case 2: exportDropFees(); break; case 3: exportDomesticRates($cname); break; case 4: exportCanadianRates(); break; case 5: exportFuelCurchargeRates(); break; default: break; } ?> <body> <p>File download in process</p> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/225098-exporting-data-to-excel-prevents-page-refresh/#findComment-1162640 Share on other sites More sharing options...
BlueSkyIS Posted January 20, 2011 Share Posted January 20, 2011 the file is sent from the server to the browser, bypassing javascript. therefore, javascript can't know when the file is finished downloading. Quote Link to comment https://forums.phpfreaks.com/topic/225098-exporting-data-to-excel-prevents-page-refresh/#findComment-1162677 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.