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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:23:28+00:00 2026-06-11T08:23:28+00:00

I have a little problem. I’ve got json datas from a $.get() request with

  • 0

I have a little problem. I’ve got json datas from a $.get() request with jQuery

Here is the output :

[
    {"name":"Silver","price":525,"per_month":"20","first_invoice":"20"},
    {"name":"Gold","price":500,"per_month":"50","first_invoice":"0"},
    {"name":"Avion","price":750,"per_month":"10","first_invoice":"10"}
]

I try to generate an UL with an LI for each objetcs…

I write this little code :

//send get request
    $.get(
        url, 
        { 'dst': dst, 'price':price },
        function(data) {

            var objects = jQuery.parseJSON(data);

            var items = [];

            jQuery.each(objects, function(){
                console.log(this);

                items.push('<li id="' + this.name + '">' + this.price + '</li>');
            }); 

            jQuery('<ul/>', {
                'class': 'my-new-list',
                html: items.join('')
            }).appendTo('#results');                
        }
    );

When i use console.log()each objects are logged by firebug : no error… it works.

This is the items.push() and the appendTo() which generate nothing… no error in the console… no append in my #results div…

I’m sure I do something wrong. Can anyone help me ?

Update

With the help of Fabrício Matté (answer after), the problem was the iframe.

jQuery('<ul/>', {
                'class': 'my-new-list',
                html: items.join('')
            }).appendTo(jQuery('body').find('#results'));  

That works =)

Sey you soon Stackoverflow Community

  • 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-11T08:23:29+00:00Added an answer on June 11, 2026 at 8:23 am

    edit: As per João’s comment, your original code is working perfectly fine. Make sure that:

    1. #result is in the DOM when you try to append the data;
    2. jQuery.parseJSON(data) returns an array of objects;
    3. jQuery is properly included and there are no syntax errors before executing that line;
    4. I rewrote the code slightly to make it easier to read as well:

      var objects = jQuery.parseJSON(data);
      
      var items = '';
      
      jQuery.each(objects, function(){
          items += '<li id="' + this.name + '">' + this.price + '</li>';
      }); 
      
      jQuery('<ul/>', {
          'class': 'my-new-list'
      }).html(items).appendTo('#results');
      

    Fiddle


    EDIT

    As per OP’s comment, you can’t use a selector to select elements inside of an iframe without referencing its document first. Here’s how I’d do it with contents() and find():

    //replace the $('iframe') with ID/class selector if possible
    jQuery('iframe').contents().find('#results').append(jQuery('<ul/>', {
        'class': 'my-new-list'
    }).html(items));
    

    Fiddle

    Note that this does not work if the iframe document is from a different host, port or protocol.
    Same Origin Policy reference

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

Sidebar

Related Questions

I have a little problem with Jquery getJSON function. my json here { entries:
I have a little problem with jQuery Tabs. I get it to work well.
I'm have little problem in retrieving the data from a table here's the code:
I have this little problem with json. //real json var json1 = {test1:TEST1,test2:TEST2,test3:TEST3,test4:TEST4}; alert(json.test1);
I have little problem. I can't use AcceptVerb.Get on some ASP.NET MVC actions because
I am very new to jQuery/JS and I have little problem with add or
i have a little problem here. I am working on a little application wich
I have a little problem with my if statement when date.name is about this
I have one little problem...Here is my code..Is there a way to distribute weights
I have a little problem, I am building a database from CSV files using

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.