Mithun Sreedharan
Mithun Sreedharan

Reputation: 51272

jQuery XML export or Simple JavaScript file download

I have dynamically created a xml string form a JSON object returned from server. I need to give the user to download this as a file so that when the user click the button named export he/she receives a downloadable.xml file and can be save d on local machine.

Is this possible?

Upvotes: 2

Views: 3623

Answers (2)

Chris Ostler
Chris Ostler

Reputation: 687

I was recently looking for something similar, and came across Downloadify. It appears to use a feature of Flash 10 to work around the filesystem limitation of JavaScript.

Upvotes: 3

kgiannakakis
kgiannakakis

Reputation: 104178

Have you generated the file on the server or on the client?

If you have generated the file at the server you can use the content-disposition header. You also need to set the content type to application/xml or text/xml.

If you have generated the file using jQuery, then it isn't possible for the user to save it locally. Javascript isn't allowed access to the file system.

Upvotes: 2

Related Questions