-1
function savecsv(){
    var obj = {};
    $("input").each(function(){ obj[this.id]=this.value;});
    console.log(obj);
    var csv = Papa.unparse(obj);
    return csv; 
} 

Hey i have some, prolly simple problems using papa.unparse, it creates empty csv files. I tried some of the config possibilities but couldnt make it work. Someone could give me a hand? I only want the user beeing able to save his input(id and value) for later use. Thx!

Ignacio Ara
  • 2,476
  • 2
  • 26
  • 37

1 Answers1

0

Try this:

function savecsv(){

    var obj = [];

    $("input").each(function(){ obj.push([this.id, this.value]); });

    console.log(obj);

    var csv = Papa.unparse(obj);
    return csv; 

}
Nigel Nelson
  • 110
  • 1
  • 9