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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:33:21+00:00 2026-05-23T03:33:21+00:00

I am pulling data with $.getJSON and displaying it in a div. I thought

  • 0

I am pulling data with $.getJSON and displaying it in a div. I thought I would have another json query to get one product but I don’t so I was wondering of there is anyway to query the results or just grab a few variables to pass? I need to pass one record to another page. I found this on this site:

var people = json.filter(function(el)
{          
   return el.Phoneno.some(function(number)
   {
       return number.Cell == "777-777-7777";     
   });
}); 

Seems like I need to pull the entire query again though and parse through it. Is there away to just pass a few variables to another page? Very new to jQuery, if someone could point me it right direction that would be great, thanks for any help!

UPDATE:

$.getJSON("myurl", function(data){
   $.each(data.myproducts, function(i,item){
      $("#products").append("<li><a href='"+item.Url+"' target='_top'><img src='"+item.image+"'></a>"
                           +"<br>"+item.Name+"<br>"+"$"+item.saleprice+"</li>");
    });
});
  • 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-23T03:33:22+00:00Added an answer on May 23, 2026 at 3:33 am

    You can pass a JavaScript object:

    var data = {
        url: 'http://example.com',
        image: 'http://placekitten.com/200/300',
        name: 'can haz cheezburger?'
    };
    

    through a URL query parameter by serializing it to JSON:

    var strData = JSON.stringify(data);
    // '{"url":"http://example.com","image":"http://placekitten.com/200/300","name":"can haz cheezburger?"}'
    

    and then URL-encoding it:

    var encodedStrData = encodeURIComponent(strData);
    // '%7B%22url%22%3A%22http%3A%2F%2Fexample.com%22%2C%22image%22%3A%22http%3A%2F%2Fplacekitten.com%2F200%2F300%22%2C%22name%22%3A%22can%20haz%20cheezburger%3F%22%7D'
    

    and then adding it to the query string of a URL. If you have an anchor like this:

    <a id="next" href="next/page">Next Page</a>
    

    you can modify it with jQuery like this:

    var $next = $('#next'),
        url = $next.prop('href') + '?data=' + encodedStrData;
    
    $next.prop('href', url);
    

    The receiving page will then have to unpack the data in the URL, if present.


    …or you could just pass some sort of item ID:

    <a href="next/page?item=42">Next Page</a>
    

    Edit

    Try this, which uses $.param(...) instead of encodeURIComponent(JSON.stringify(...)):

    $.getJSON("myurl", function(data)
    {
        $.each(data.myproducts, function(i,item)
        {
            var url = 'details.html?' + $.param({data: item});
           
            $("#products").append("<li><a href='"+url+"' target='_top'><img src='"+item.image+"'></a>"
                   +"<br>"+item.Name+"<br>"+"$"+item.saleprice+"</li>");
        });
    });
    

    This can definitely be cleaned up, but I’ve left it as similar to the original code as possible for clarity. CodeReview.SE is a great resource for improving correct code.

    Then, on the receiving page, you need to grab the value of the data parameter. I recommend using jQuery BBQ for that:

    $(function ()
    {
        var item = $.deparam.querystring().data;
        // Item is now one of the items from the JSON on the previous page.
        // Do whatever you need with it
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an INSERT query that is pulling data from two tables and inserting
How can one programmatically sort a union query when pulling data from two tables?
I can't figure this out. I have a query pulling data from a couple
I have a MS SQL Query that is pulling data via from a remote
Accomplished pulling data from JSON, but having problems trying to pull additional information from
right now I have this pulling data for the current week, but the week
I am pulling data from one table, called analyzedCopy, and using it to over-rite
I have the following function that is pulling data from a database. The ajax
I have data in Excel files that I am pulling out using the MS
I'm pulling data from a feed that I have no control over and I

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.