Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Closed Thread
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-01-2012, 03:56 AM   PM User | #1
Rory Barrett
New to the CF scene

 
Join Date: Oct 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rory Barrett is an unknown quantity at this point
Question CSV to array

Hello fellow Javascript users

I am keen to have a simple script that reads a csv file in the samefolder as my html page and puts it in a javascript array. I succeeded in getting a script to display the casv file as a table on the html page however it would be extremely useful to get the csv data into an array. I have been using jquery but I must be making some major errors.

Rory Barrett
Rory Barrett is offline  
Old 10-01-2012, 04:04 AM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,461
Thanks: 52
Thanked 457 Times in 455 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
in broad terms, you would make an ajax call, get the content of the csv file, and use the javascript split() method to split that content on the commas, which results in a useable array.

It's about 99% likely that your existing code only needs a minor tweak to get that happening. In fact, I'm curious as to how you get the CSVs into a table without doing the above or something similar. Can you post your working code?
xelawho is offline  
Closed Thread

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:13 PM.


Advertisement
Log in to turn off these ads.