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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:57:23+00:00 2026-05-28T00:57:23+00:00

I have several situations where I need to pass multi-dimensional PHP arrays into Javascript/jQuery.

  • 0

I have several situations where I need to pass multi-dimensional PHP arrays into Javascript/jQuery. The PHP function json_encode() seems to do this rather well. I’ve seen some examples that use $.parseJSON, but I’m not sure if this is for IE6 compatibility or some other issue. Can anyone elaborate if this is the correct format to use in JavaScript. Assume this is javascript/jQuery as part of a PHP view.

var sections = <?php echo json_encode($sections); ?>;

Or, perhaps this would be better?

var sections = <?php if (!empty($sections)) { echo json_encode($sections); } else { echo "new Array()"; } ?>;

Or, do I need $.parseJSON? It seems to throw an error.

var sections = $.parseJSON(<?php echo json_encode($sections); ?>);

Does anyone know of any IE6 issues I should be aware of? If I should use parseJSON(), is it used with single or double quotes?

Thanks in advance,
Jeff Walters

  • 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-05-28T00:57:24+00:00Added an answer on May 28, 2026 at 12:57 am

    I don’t know anything about IE, but as long as you aren’t dealing with JSON strings in JavaScript you will not need any parseJSON function. Just putting them out into the script text should be fine.

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

Sidebar

Related Questions

I'm a CSS/JQuery rookie, but have built several things with the basics. Just need
I have a situation where I need to concatenate several string to form an
Background: I have a ListView / GridView with several columns. In some situations, only
I have a situation where I need access to a shopping cart over several
I have several independent executable Perl, PHP CLI scripts and C++ programs for which
I currently have javascript/jquery to 'add and remove' steps from a set of instructions
Situation: I have several SSRS reports of which I need the sql-code to be
My situation: I have several components, which sometimes have changes to them, and are
I have a situation where I have several listbox controls on the same asp.net
I have a situation where I have several VB.NET Modules in the same Logical-Module

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.