I've encountered an issue while trying to write an array to a file. The code snippet is as follows:
for(i=1;i<tblRows;i++)
{
facID=tbl.rows[i].cells[1].innerHTML;
money=tbl.rows[i].cells[2].innerHTML
content+=facID+','+money+"\n";
result+=parseFloat(money);
}
alert(content);
window.open('data:text/txt;charset=utf-8,'+escape(content));
When I view the data in an alert, it displays correctly with new lines, but when I write it to a file, all the data gets concatenated in a single line. How can I format the data in the file like this example:
12236545,4,269731,88468,13960620
1/11,9
2/22,8
3/33,7
4/44,4
Thank you