Best way to execute a javascript and php csv export script
<p>I have a PHP page which generates an HTML table. At the bottom of the page, you can click a 'submit' button and the data from the table is sent to a jquery script called Table2CSV (<a href="http://www.kunalbabre.com/projects/table2CSV.php" rel="nofollow">link here</a>) which takes the data, and submits to another php script for CSV export. </p>

<p>Ultimately, all of the action takes place here:</p>

<p></p>

<pre><code>&lt;form action="getCSV.php" method ="post" &gt; 
&lt;input type="hidden" name="csv_text" id="csv_text"&gt;
&lt;input type="submit" value="Get CSV File" 
       onclick="getCSVData()"
&lt;/form&gt;


&lt;script type="text/javascript"&gt;

function getCSVData(){
 var csv_value=$('#example2').table2CSV({delivery:'value'});
 $("#csv_text").val(csv_value); 
}
&lt;/script&gt;
</code></pre>

<p>What I'd like to do is generate the csv script without ever having to output the html table to the screen (via a link click on another page). </p>

<p>I think I ultimately need to simply change the javascript function above to call getCSVdata on page load then run getcsv.php but not sure how to do that exactly as I'm not very familiar with JS.</p>

<p>Any suggestions?</p>
