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

  • Home
  • SEARCH
  • 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 6544321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:27:06+00:00 2026-05-25T11:27:06+00:00

I want to get the value of json array using .each here’s where I

  • 0

I want to get the value of json array using .each

here’s where I set the values of array

$allRecords= array();
    while($row = mysql_fetch_array($result)){
        $oneRecord[] = array("orderNo"=>$row['order_no'],"orderDate"=>$row['order_date'],"orderTime"=>$row['order_Time']);
        array_push(&$allRecords,$oneRecord);
    }

    echo json_encode($allRecords);

and here’s what I make in jquery

$.post("controllers/OrderViewer.controller.php?action=viewOrders",param,function(result){
 // var data = JSON.parse(result); // I tried this but doesn't work
 // var data= eval(result);  // I tried this but doesn't work

    $.each(result,function(index,v){

            alert(index +" "+ v.orderNo);  // return undefined for values
            // what should I write here to reach array element

    });
    });

what should I write in .each to get array elements

here’s the response data structure

Array
(
[0] => Array
    (
        [orderNo] => 1
        [orderDate] => 2011-02-12
        [orderTime] => 00:00:10
    )

[1] => Array
    (
        [orderNo] => 2
        [orderDate] => 2011-02-12
        [orderTime] => 11:10:00
    )

)

  • 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-25T11:27:07+00:00Added an answer on May 25, 2026 at 11:27 am

    If index and v are returning undefined values in your each() loop, then the value of result must not be what you think it is. The only way to make progress here is for you to see what result actually looks like.

    Is it actually an array? If so, what are the items in the array? Are they what you expect? If it’s not an array, what is it?

    The best way to see result is to set a breakpoint on the start of your each() loop and look at result in the debugger. Chrome and Safari come with built-in debuggers that take 15 mins to learn how to set a breakpoint and then inspect the values of variables once it hits that breakpiont. Firefox has a free add-on (Firebug) that gives it a debugger too. IE has tools you can download from MS with a debugger.

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

Sidebar

Related Questions

I want to get the value of my integer array, at an index. The
i want to get the value of this td my code function check() {
i bascially want to get the value of a variable from the codebehind to
Basically I want to get the value of a textbox which is to select
Suppose I have a XmlNode and I want to get the value of an
i have put fckeditor in jsp page. I want to get the value whatever
I'm beginner in MVC3, and I want to get a value from an another
I want to get the exit value (returned by $? on a shell; usually
I want to get the CreateDate value from xml file the xml file is
I want to get the distinct value of a particular column however duplicity is

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.