Is there any way I can create a text file on the client side and prompt the user to download it, without any interaction with the server? I know I can't write directly to their machine (security and all), but can I create and prompt them to save it?
You can use data URIs. Browser support varies; see Wikipedia. Example:
<a href="data:application/octet-stream;charset=utf-8;base64,Zm9vIGJhcg==">text file</a>
The octet-stream is to force a download prompt. Otherwise, it will probably open in the browser.
For CSV, try:
<a href="data:text/csv,field1%2Cfield2%0Afoo%2Cbar%0Agoo%2Cgai%0A">CSV</a>
Try the jsFiddle demo.
No, this is not possible. Only resources sent after an HTTP request can be downloaded by the user. It is more common to have dynamic resources that need to be downloaded by the user generated on the server.
It actually IS possible - use Flash.
You can either generate the content with JS and then initialize some flash vars or just do everything within a flash movie.
Please take a look at this for some important remarks.
If the file contains text data, a technique I use is to put the text into a textarea element and have the user select it (click in textarea then ctrl-A) then copy followed by a paste to a text editor.