Application requests KML data through AJAX from server. This data is stored in javascript variables, and displayed in Google Earth plugin.
In javascript, how do I
Yeah, I'm afraid you have to pass it back to the server. Make a generic "echo" script that spits out whatever parameters are fed to it.
At least you can force a download with the right MIME type:
"content-disposition","attachment; filename=data.xml"