I am attempting to make a php script that returns a CSV file from a JSON array, but I am having trouble getting the info to the script. To make this CSV downloadable, I need to set the headers using php and create the CSV file on the fly (so I don't have to store it on my server), thus it seems I need to redirect the user's browser to my PHP script (aka no AJAX).
I want to post 3 variables. A user ID, a session string, and the stringified JSON array.
I could just use Jquery to create an input with the value of my JSON array, as such:
$('html-input-element').val(stringified-JSON-array);
But that does not seem ideal, as this JSON array could be thousands of lines long. Is there any way to do this purely in javascript? I would also rather use POST than GET because the session string is sensitive info. Thanks so much!