Esercizio con JSON con Ajax e jQuery

In questo esercizio caricheremo un dummy file JSON per importare degli utenti ed estrapolare solo le informazioni che ci servono.
Sintassi di Ajax (versione short) con jQuery
//Carica JSON-encoded data dal servere usando la richiesta GET HTTP.
$.getJSON('https://dummyjson.com/products', function(data){
//funzione
$.each(data, function(index, element){
//svolgimento funzione
});
});
Esempio in funzione
Codice della Lezione: Caricare file JSON via AJAX e jQuery
//inizializzazione jQuery
$(document).ready(function(){
//metodo abbreviato per Caricamento Json
$.getJSON('https://dummyjson.com/users', {cache : false}, function(data){
// definizione variabili per ciclo forEach
let usersdata = data['users'];
let $elem = $('.prcard');
$.each(usersdata, function(index, element){
$elem.append(
$('<div/>', {class: 'prbox'}).append(
$('<figure/>', {class: 'prfig'}).append(
$('<img>').attr("src",usersdata[index].image)
)
).append(
$('<div/>', {class: 'information'}).append(
$('<p>',{html: '<b>First Name</b> :' + usersdata[index].firstName}),
$('<p>',{html: '<b>Last Name</b> :' + usersdata[index].lastName}),
$('<p>',{html: '<b>Age</b> :' + usersdata[index].age}),
$('<p>',{html: '<b>Gender</b> :' + usersdata[index].gender})
)
)
);
});
})
});