javascript return function's data as a file
Posted
by Dennis
on Stack Overflow
See other posts from Stack Overflow
or by Dennis
Published on 2010-05-20T19:21:29Z
Indexed on
2010/05/20
19:30 UTC
Read the original article
Hit count: 395
javascript-execution
|php
I have a function in javascript called "dumpData"
which I call from a button on an html page as **onlick="dumpData(dbControl);"*
What it does is return an xml file of the settings (to an alert box right now). I want to return it to the user as a file download. Is there a way to create a button when click will open a file download box and ask the user to save or open it? (sorta of like right-clicking and save target as)...
Or can it be sent to a php file and use export();?
Not sure how I would send a long string like that to php and have it simple send it back as a file download.
Dennis
© Stack Overflow or respective owner