Загрузить файлы в «sk1/scripts»
This commit is contained in:
parent
4aaf943bd2
commit
16bb5fa94a
17
sk1/scripts/app.js
Normal file
17
sk1/scripts/app.js
Normal file
@ -0,0 +1,17 @@
|
||||
function showRandomUser() {
|
||||
fetch("/random_user")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const display = document.getElementById("random-user-display");
|
||||
if (data.error) {
|
||||
display.innerHTML = `<p style="color:red;">${data.error}</p>`;
|
||||
} else {
|
||||
display.innerHTML = `
|
||||
<div class="random-user-card">
|
||||
<img src="https://api.dicebear.com/8.x/initials/svg?seed=${data.name}" class="avatar">
|
||||
<strong>${data.name}</strong><br>
|
||||
<small>Pridané: ${data.created_at}</small>
|
||||
</div>`;
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user