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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:57:47+00:00 2026-06-04T09:57:47+00:00

I am using data that’s in a csv file to display it using JSON.

  • 0

I am using data that’s in a csv file to display it using JSON. I can see it in the alert, but not in the html. Also, I tried to create an associative array to make it easier to refer to through Jquery, but it’s not being passed that way.

 <?php 
 if (($handle = fopen('upload/05-22-2012-1-43-28BEN-new.csv'. '', "r")) !== FALSE) {
       while (($row_array = fgetcsv($handle, 1024, ","))) {
            while ($val != '') {
                foreach ($row_array as $key => $val) {
                        $row_array[] = array_combine($key, trim(str_replace('"', '', $val)));
                        }
                }
            $complete[] = $row_array;
            //print_r($row_array);

            }
            fclose($handle);
        }
        echo json_encode($complete);

 ?>

HTML

 <body>    
      <div id="showdata"></div>

 </body>

JQuery

 $(document).ready(function(){
    $.getJSON('WF-XML.php', function(data) {
        alert(data); //uncomment this for debug
        //alert (data.item1+" "+data.item2+" "+data.item3); //further debug
        $('#showdata').html(data);
    });
});

Results

 [["11704","1611704","BENV1072"],["11703","1611703","BENV1073"]]
  • 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-04T09:57:48+00:00Added an answer on June 4, 2026 at 9:57 am

    First of all you need to stringify your object using JSON.stringify, also .html() method does not escape the string – try using .text() instead.

    I’ve created a simple fiddle for testing – http://jsfiddle.net/E9KTy/

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

Sidebar

Related Questions

I have some data that I want to display as a box plot using
I have some data that I have to serialize to JSON. I'm using JSON.NET.
Is there some way using data annotations that I can check the value of
I am sending data using the HTTP POST verb . But I am not
I'm trying to create an image by using binary data that I received from
I am posting some data using ajax. I want to manipulate that data and
I'm trying to make a decision tree using rpart using a data frame that
I am using a hardware interface to send data that requires me to set
I have a range of data that I have approximated using a polynomial of
If I have the following data that is printed seperated by tabs using print

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.