Created
August 25, 2022 04:44
-
-
Save Sidheeqpallam/84c009ab2ecc146d44ce2cd323b5590b to your computer and use it in GitHub Desktop.
Csv file downloading code javascript ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const download = function(data){ | |
const blob = new Blob([data], {type : 'text/csv'}); | |
const url = window.URL.createObjectURL(blob); | |
const a = document.createElement('a'); | |
a.setAttribute('hidden', ''); | |
a.setAttribute('href', url); | |
a.setAttribute('download', 'download.csv'); | |
document.body.appendChild(a); | |
a.click(); | |
document.body.removeChild(a); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment