I have a download summary page that loads after a users selects specific elements to include in the csv file. I would like to show the user the summary page and automatically start the download. Since both the summary and the csv export require much of the same code I have it on the same page. I am appending to the post array after the initial load with a reference code. So if the post array contains a reference code it executes the code for the csv if not it executes the code for the summary display. I am doing this with an ajax post on page load. Everything works great except the fact that it returns the raw data stream for the csv and does not put it into a file. Does anyone have any ideas on how I can accomplish this?
Also I should mention my initial form is very complex and has many nested fields so looping through the post array and creating hidden fields is not a good solution.
Thanks for any help on this.