123456789101112131415161718192021222324252627282930313233343536373839 |
- <script type = 'text/javascript' >
- function scaricatiCsv() {
- var risposte = jQuery(".wpcf7-form-control"); //e questo è un array di oggetti poi dobbiamo fargli pushare uno per uno il loro valore
- var valoribuoni = [];
- jQuery(risposte).each(function (index, value) {
- valore = "";
- console.log(index);
- console.log(value);
- valore = jQuery(value).val();
- valoribuoni.push(valore);
- });
- var csvRows = [];
- csvRows.push(valoribuoni.join());
- var csvString = csvRows.join("%0A");
- var a = document.createElement('a');
- var linktext = "Scarica la scheda e mettila al sicuro";
- a.href = 'data:attachment/csv,' + csvString;
- a.target = '_blank';
- a.download = 'schedaProduzione.csv';
- a.innerHTML = linktext;
- var mettiloqui = jQuery("form.wpcf7-form");
- mettiloqui.append(a);
- };
- </script>
|