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 7913583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:52:39+00:00 2026-06-03T13:52:39+00:00

I have a HTML page full of data separated by commas and each row

  • 0

I have a HTML page full of data separated by commas and each row ends in a (br /) tag. In Javascript I can get this from the DOM by asking for the innerHTML of the element containing the data.

My question is how to parse the innerHTML to get the data out from between the commas and start on the next line when it hits the (br /) tag?

You can probably ignore the rest as that is my question above.

When I parse each line I will start a new object and put the data into it. I’m just not sure what to do with the innerHTML!

I did put the data through a CSVtoarray function I found but ended up with an array of one large array instead of an array of arrays for each line. I can work my way through this array creating objects from the data along the way but turning the innerHTML into a single array seems an unnecessary step when I could parse the data straight into object.

The data is put there via AJAX. I can change the format that the data comes in. As I said I have it separating data with commas and (br /) tag at the end of the line. I do not know if this is stupid or not.

  • 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-03T13:52:40+00:00Added an answer on June 3, 2026 at 1:52 pm

    You mention that you have control over the data you’re getting via AJAX, and you’re right that your current approach is not the best idea. First off, you should never try to parse HTML on your own, even if you think it’s “simple” – different browsers will give you different innerHTML for the exact same content. Instead, use the DOM to find the information you’re looking for.

    That said, the correct approach here is just to return a JSON object from the server; you’ll then have direct access to your data. Nearly every server-side language has some kind of facility to output JSON, and JavaScript can parse the JSON string natively1 with JSON.parse().

    From the server, return:

    {items: [
        { id: 0, name: '...' },
        { id: 1, name: '...' },
        ...
    ]}
    

    On the client (assuming jQuery),

    $.getJSON('/path-to-script/', function(d) {
        for (var i = 0; i < d.items.length; i++) {
            d.items[i].id;
        }
    });
    

    1 – in modern browsers

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

Sidebar

Related Questions

My JavaScript is as follows: $.get(/<page>.php, userid='.$userid.'&+status, function(data){ $(#status).show(fast).html(data).delay(4000).hide(fast); }); I have many links
I have an html page full of data. Whenever the user hovers over an
I have a var that contains a full html page, including the head, html,
I have this html page which is very simple, it contains a text box
I have an HTML web page full of divs and span tags identified with
I have next code block: $.post('page.php', function(data) { //data - full page info });
I have an HTML page which contains an Object tag to host an embedded
Chrome can edit Javascript on the fly, without a full page refresh, similar to
I have HTML page where windows media player is embedded. It works very well
I have HTML page with some HTML element with ID=logo . I need to

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.