How do I download JavaScript string as a file

前端 未结 8 753
太阳男子
太阳男子 2021-01-13 18:52

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

8条回答
  •  太阳男子
    2021-01-13 19:34

    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"
    

提交回复
热议问题