function loadJSON(path, success, error) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { if (xhr.status === 200) { success(JSON.parse(xhr.responseText)); } else { error(xhr); } } }; xhr.open('GET', path, true); xhr.send(); } loadJSON("https://dtf.ru/vote/get_likers?id=1445267&type=1&mode=raw", getRandom,'jsonp'); function getRandom(data) { const values = Object.values(data.data.likers) const randomValue = values[parseInt(Math.random() * values.length)] console.log('Победитель:') console.log(randomValue.user_name) console.log(randomValue.user_url) }