j2trumpet

msg:4060300 | 12:19 am on Jan 14, 2010 (gmt 0) |
Or maybe even from a .csv file exported from Excel.
|
j2trumpet

msg:4067687 | 11:09 pm on Jan 25, 2010 (gmt 0) |
*bump* I'm still hoping to find a way for Javascript to read .csv files. Thanks.
|
daveVk

msg:4068552 | 11:10 pm on Jan 26, 2010 (gmt 0) |
Javascript can read any file, provided it resides on the server (not the client) and placed such that it can be accessed via a URL. But not sure if that is what you are asking ?
|
j2trumpet

msg:4068588 | 11:53 pm on Jan 26, 2010 (gmt 0) |
Okay. Since you say it is possible, how would I go about looping through the .csv file, loading each line into a new item in an array? Example: CSV item1value1,item1value2 item2value1,item2value2 item3value1,item3value2 Javascript var list = new Array(); list[0] = "item1value1,item1value2"; list[1] = "item2value1,item2value2"; list[2] = "item3value1,item3value2"; The array won't be written out like it is here as its content will be pulled directly from the specified .csv file.
|
daveVk

msg:4068684 | 3:03 am on Jan 27, 2010 (gmt 0) |
assuming replyS contains the csv file var list = replyS.split( '\n' );
|
j2trumpet

msg:4068741 | 6:19 am on Jan 27, 2010 (gmt 0) |
I didn't know \n worked in Javascript too. I thought it was just a PHP thing. How would I load the .csv content into replyS?
|
daveVk

msg:4068857 | 12:36 pm on Jan 27, 2010 (gmt 0) |
The short answer is AJAX, using one of the frameworks like JQuery makes it a lot easier. Eg. jQuery.ajax({"url":"/my.csv" ,"cache":false ,"type":"get" ,"success":function(replyS){ alert( replyS); } ,"error":function(req,errorS,excep) { alert( errorS ); } });
|
j2trumpet

msg:4069405 | 11:03 pm on Jan 27, 2010 (gmt 0) |
I'm not that familiar with jQuery. Is it something I'd have to load or install onto the server? I have FTP access to my area of the server but not admin rights.
|
daveVk

msg:4069421 | 11:22 pm on Jan 27, 2010 (gmt 0) |
It's just a matter of moving the js files into your area of the server typically a jquery directory in the main directory. Alternatively I understand that 3rd parties like google serve these files as a free service.
|
|