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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:47:52+00:00 2026-05-27T13:47:52+00:00

I currently have a json object, that I loop through and output a list

  • 0

I currently have a json object, that I loop through and output a list of links.

See fiddle:
http://jsfiddle.net/jasonday/hzZ8j/

each link is given an id based upon the storeID in the json.

What I want to do, is when a link is clicked it finds the id in the json, and then writes the sibling element “otherData” to #otherDataDiv

I’ve worked with traversing xml, but I’m not sure how to accomplish this with json.

Any help would be appreciated. thanks.

  • 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-27T13:47:53+00:00Added an answer on May 27, 2026 at 1:47 pm

    You just have to loop over, like this:

    var target = "store17",
        foundStore = {};
    for(var k1 in object.state){ var state = object.state[k1];
      for(var k2 in state.store){ var store = state[k2];
        if (store.storeid == target){
          foundStore = store;
          break;
        }
      }
    }
    

    However, if you were using jQuery templates then you could just look for ‘tmplItem’ in the data array on the element.

    Additionally, if you weren’t building the HTML manually for this, I would suggest using jQuery data here for this project. It would solve your problem immensely.

    to store: $(selector).data('unique name here',data);

    to retrieve: var usefulname = $(selector).data('unique name here');

    and then in your onclick for each link you could:

    var otherData = $(this).data('unique name here').otherData;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have the following function that iterates through a json response object (val2):
I currently have a DetailsView in ASP.NET that gets data from the database based
I have a JSON object that looks like this. [ { id : 23,
I have a controller action that is receiving a complex object via JSON. The
I'm currently having an issue where I have a javascript object that is trying
I have a GeoDjango model object that I want't to serialize to json. I
I have a simple object that is deserialized from JSON into a server-side object.
Currently, I have json data of several twitter feeds that I parse to fill
I currently have an MS Access application that connects to a PostgreSQL database via
I have two JSON objects here, generated through the Google Search API. The URL's

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.