JSFiddle - React, Tailwind, and code Playground
HTML
<button id="btn">dodaj</button>
<div id="info"></div>
JavaScript
var
index = 0,
USERS = null;
$.ajax({
url: 'https://api.github.com/users',
type: 'GET',
success: function (data) {
USERS = data;
}
});
$('#btn').on('click', function () {
if (index <= USERS.length) {
$('<div>').append(
$('<p>', { text: 'Dane kontaktowe: ' + USERS[index].login }),
$('<img>', { src: USERS[index].avatar_url, width: 100, height: 100 })
).appendTo('#info');
index += 1;
}
});