'How to make a loop with a Jquery subarray Json?
I have this array and I need to get the public_id and format values
{"resources":[{"public_id":"samples/3_zm3ex0","version":1643650862,"format":"jpg","width":4000,"height":3000,"type":"upload","created_at":"2022-01-31T17:41:02Z"},{"public_id":"mggvuz0xisg2nzkldbvx","version":1643520511,"format":"jpg","width":500,"height":549,"type":"upload","created_at":"2022-01-30T05:28:31Z"},{"public_id":"samples/cloudinary-group","version":1643517184,"format":"jpg","width":3000,"height":1526,"type":"upload","created_at":"2022-01-30T04:33:04Z"}],"updated_at":"2022-01-31T18:28:07Z"}
I try to do it like this but without success
$(document).ready(function() {
$("#fetch").click(function(event) {
$.getJSON('https://res.cloudinary.com/dkx20emez/image/list/dom.json', function(emp) {
$('#display').html('<p> Name: ' + emp.resources.public_id + '</p>');
$('#display').html('<p> Name: ' + emp.resources.format + '</p>');
});
});
});
I appreciate your help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
