Create a Download link with javaScript (Front End Stuff)

If you want to have some content fetched by JavaScript you just need to do as follows:
Download File

Now this is simple create the content hardcoded but you can do whatever you want, here is an example on getting content from server download the file
          ${responseItem.xmlRequest} 

          Download Request
          


This is a live demo, just click HERE to download a file generated as the above code
Is worth to mention that if you have spaces on your test you need to encode them, otherwise those will disappear as in the download file above. The reference for this can be found at http://stackoverflow.com/questions/7717851/save-file-javascript-with-file-name

Comments