Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8969345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:34:43+00:00 2026-06-15T17:34:43+00:00

I have a CSV which I need to display on a page. I can

  • 0

I have a CSV which I need to display on a page. I can do this via $.get() but once I have the (data) how can I separate it and allocate where to display it. Each line is separated by a |

Currently I’m using this code to display the info in a div:

$.get('feed.txt', function(data) {
$('div').html(data.replace(/\|/g, '<br>'));
});

I know this is probably a very big question to ask, so if anyone has encountered a good tutorial that would be awesome too.

UPDATE
Here is an example of the data I’m pulling in:

TYPE: Small, ID: 0001, RESPONSE DATE AND TIME: 2012-12-12 12:00, UNITNAME: Name, MEMO: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.|
TYPE: Medium, ID: 0002, RESPONSE DATE AND TIME: 2012-12-12 01:00, UNITNAME: Name, MEMO: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.|
TYPE: Large, ID: 0003, RESPONSE DATE AND TIME: 2012-12-12 02:00, UNITNAME: Name, MEMO : Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.|
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:34:44+00:00Added an answer on June 15, 2026 at 5:34 pm

    You can try,

    Try 1:

    I used split() to convert string to array delimited by | and loop each array value to add div element and send it to $('div').html(values);

    $.get('feed.txt', function(data) {
        var arr = data.split('|');
        var values = '';
        for(var i=0; i<arr.length; i++){
          values += '<div>'+arr[i]+'</div>';
        }
        $('div').html(values);
    });
    

    Demo: http://jsfiddle.net/d3spZ/2/

    Try 2:

    Here I used replace() function to warp div elements by replacing |.

    $.get('feed.txt', function(data) {
        var new_data = '<div>'+data+'</div>';
        $('div').html(new_data.replace(/\|/g, '</div><div>'));​
    });
    

    Demo: http://jsfiddle.net/bwpjR/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have unpredictable frequency of Incoming csv data file which I need to store
I have a CSV file which contains data seperated with tabs. I need to
I have a csv importroutine which imports my CSV values into Sitecore. After this
I have this common issue of 'new line' in php-csv which is making me
I have multiple CSV files which I need to parse in a loop to
I have a flat CSV file which I need read from to end up
I have a csv file with 48 columns of data. I need to open
I have a CSV file with many rows in which I need to update/replace
I have a list of csv files which I need php to convert to
I have two CSV files (three columns) which I need to compare and extract

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.