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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:32:22+00:00 2026-05-30T23:32:22+00:00

This php function returns a json encoded object to a javascript through ajax. I

  • 0

This php function returns a json encoded object to a javascript through ajax. I create a variable with this json object with stringify.

var event_id = JSON.stringify(rdata.event_id);

When I print that variable it looks like this.

[{"0":"e20111129215359"},{"0":"e20120301133826"},{"0":"e20120301184354"},{"0":"e20120301193226"},{"0":"e20120301193505"},{"0":"e20120303182807"},{"0":"e20120303205512"},{"0":"e20120303211019"},{"0":"e20120306182514"},{"0":"e20120307122044"}]

How do I access each element of event_id?

  • 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-30T23:32:23+00:00Added an answer on May 30, 2026 at 11:32 pm

    Don’t stringify it. It’s already a valid JavaScript object, so just access it directly with:

    rdata.event_id[0]["0"];
    // e20111129215359
    
    // Or read them in a loop
    for (var i=0; i<rdata.event_id.length; i++) {
       console.log(rdata.event_id[i]["0"];
    }
    

    The value rdata.event_id is an array [] containing a bunch of object literals {} each having just one property "0". Since the property is a number instead of a string, you need to use the ["0"] syntax to access it, rather than the normal object dot operator.

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

Sidebar

Related Questions

I'm using jQuery's $.ajax method to call getjson.php which returns a JSON object using
My jquery looks like this var formContent =action=view&msgid=+id; $.getJSON(myserv.php,formContent, function(json){ $.each( json, function(k, v){`
Why does this code always return 0? var possibleMatches = new Array(); $.getJSON('getInformation.php', function(data)
I have a php page that returns json like this: while ($row = oci_fetch_array($stid,
I'm calling ajax.php with jQuery. It returns a JSON response all the time. $.ajax({
How can I this PHP function include in jquery .html? PHP function: function trim_text($string,
this is function.php of a wordpress theme that NOD32 says this code have a
I'm getting this problem: PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable
This example is from php.net: <?php function Test() { static $a = 0; echo
i'm referring this address for function olLiTree PHP function that creates a nested ul

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.