jquery each for objects

0 votes
<script>
    $(document).ready(function() {
        var data = { "programs": [ { "name":"zonealarm", "price":"500" }, { "name":"kaspersky", "price":"200" } ] };
        $.each(data.programs[0], function(key,val) {
            alert(key+val);
        });
    });
</script>

This code retrieves the first data. name:zonealarm and price:500.

How can I retrieve all the data in the object?

I tried $.each(data.programs, function(key,val) but it didn't work.

Should I put it in a loop?

Jul 20, 2022 in Web Development by gaurav
• 23,260 points
150 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Web Development

0 votes
1 answer

Microsoft CDN for jQuery or Google CDN?

You should absolutely use the Google CDN ...READ MORE

answered Jun 22, 2022 in Web Development by rajatha
• 7,640 points
466 views
0 votes
1 answer

$("#select option:second").val() jquery - keep select second value of select box option

Yes, you want the special jQuery eq() selector. ...READ MORE

answered Jun 22, 2022 in Web Development by rajatha
• 7,640 points
2,425 views
0 votes
1 answer

jQuery $(this) selector function and limitations

this isn't a jQuery "thing", but a basic JavaScript ...READ MORE

answered Jun 23, 2022 in Web Development by rajatha
• 7,640 points
313 views
0 votes
1 answer

jQuery find, each, children and accessing sub-children

Well you code is not really correct. .find() does ...READ MORE

answered Jun 27, 2022 in Web Development by rajatha
• 7,640 points
4,156 views
0 votes
1 answer

Test jquery for vulnerabilities

The following blog post will help you. MKSB(en): ...READ MORE

answered Jun 30, 2022 in Web Development by rajatha
• 7,640 points
453 views
0 votes
0 answers

JQuery $.ajax() post - data in a java servlet

I want to send data to a ...READ MORE

Jun 29, 2022 in Web Development by gaurav
• 23,260 points
1,697 views
0 votes
1 answer

jquery $.each() for objects

The $.each() works for objects and arrays ...READ MORE

answered Feb 16, 2022 in Java by Aditya
• 7,680 points
314 views
0 votes
1 answer

jquery $.each() for objects

each(), which is used to iterate, exclusively, over ...READ MORE

answered Jun 6, 2022 in JQuery by Edureka
• 13,670 points
322 views
0 votes
1 answer

Jquery - Using .each() with variables and an IF statement

To get values from elements, you need ...READ MORE

answered Jun 21, 2022 in JQuery by rajatha
• 7,640 points
2,901 views
0 votes
0 answers

Jquery: Get each image src

I have a series of images each ...READ MORE

Aug 11, 2022 in Web Development by gaurav
• 23,260 points
3,092 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP