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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:15:38+00:00 2026-06-06T14:15:38+00:00

I am making an ajax request to an external php file, then returning some

  • 0

I am making an ajax request to an external php file, then returning some json. Most of the json is straight forward but I can’t seem to figure out how to parse the multidimensional part.


JSON:

{
    "success":"TRUE",
    "action":"JSON",
    "date":"06/29/12",
    "results":"true",
    "numResults":2,
    "0":[
        "id":1234,
        "name":"John Appleseed",
        "gender":"male",
        "average":2.5
    ],
    "1":[
        "id":5678,
        "name":"Jessica Smith",
        "gender":"female",
        "average":1.4
    ]
}

jQuery:

$.ajax({
url: "searchController.php",
data: searchData,
type: "GET",
success:function(q) {
    if (q) { // Results
        $('#search .container .body .ajax .returnedHTML .loadingScreen').hide();                                
        var json = $.parseJSON(q);
        console.log(json);
        if (json.success == "true") {
            var numResults = json.numResults;
            if (numResults == 1) {
            $('#search .container .body .ajax .returnedHTML .content').contents().remove();
            var htmlString = '<div class="searchContent"><ul><li class="returnedResults '+json.type+'"><a href="/#!/'+json.type+'/'+json.id+'/"><div class="title">'+json.name+'</div><div class="body"><div class="quickview"><ul><li><div class="average">'+json.average+'</div><br><span>Average</span></li><li><div class="rates">'+json.numrates+'</div><br><span>Rates</span></li><li><div class="followers">'+json.followers+'</div><br><span>Followers</span></li></ul></div></div></a></li></ul></div>';
            $('#search .container .body .ajax .returnedHTML .content').append(htmlString);
            console.log(htmlString);                                          
        }
    }
});

How do I parse the JSON so I can access the all the data and not just the data in the first dimension? I have looked around on this site and I can’t find anything that is either useful and/or helpful. Thank you so much!

  • 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-06T14:15:40+00:00Added an answer on June 6, 2026 at 2:15 pm

    Your arrays are at json[0] and json[1]

     ...
    for(var i in json) {
      if(!isNaN(i)) {
        ...
        refer to you variables as json[i].name, json[i].average, etc.
        ...
      }
    }                                  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making some consecutives(recrusive) ajax request to a php file that writes request
I'm making an AJAX request and sending along some JSON: $(function() { var json
I am making an ajax request to a file and as part of the
I'm making a jQuery Ajax POST request to a PHP script that returns an
I'm making an ajax request and I have some problems, this is my jquery
I'm making a AJAX request with jquery like: $.get('/Stuff.php', function (data) { $('#own').html(data); });
I am making an ajax request to a php page and I cannot for
am making an ajax call to retrive json data i then store the retrived
I'm making a ajax request to a page that does some expensive operations (re-indexing
I have some jQuery code in an external Javascript file that is making an

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.