<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?