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 in Web Development by gaurav
• 17,000 points
4 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 in Web Development by rajatha
• 7,040 points
22 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 in Web Development by rajatha
• 7,040 points
6 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 in Web Development by rajatha
• 7,040 points
10 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 in Web Development by rajatha
• 7,040 points
22 views
0 votes
1 answer

Test jquery for vulnerabilities

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

answered Jun 30 in Web Development by rajatha
• 7,040 points
15 views
0 votes
0 answers

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

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

Jun 29 in Web Development by gaurav
• 17,000 points
50 views
0 votes
1 answer

jquery $.each() for objects

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

answered Feb 16 in Java by Aditya
• 7,300 points
40 views
0 votes
1 answer

jquery $.each() for objects

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

answered Jun 6 in JQuery by Edureka
• 13,640 points
20 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 in JQuery by rajatha
• 7,040 points
9 views
0 votes
1 answer

How to use jquery with asp.net ajax?

If you weren't aware, Microsoft is planning ...READ MORE

answered Oct 15, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
186 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP