I am creating a csv file to download, using a technique similar to using the browser prompt to download a file
$csv_export = .... csv data...;
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=" . $csv_filename . "");
echo($csv_export);
exit;
The file downloads just fine. But this is in WordPress, so when I do a php exit; everything stops and the page appears to hang, and the user needs to do a page reload.
Is there any way to do this and/or force a reload so that it does not appear to user to have hung?
Thanks