2021-10-21 21:06:28 +02:00

18 lines
453 B
HTML

<iframe src="header.html" style="width: 100%; height: 200px; border: 0;"></iframe>
<button>Load user</button>
<p>
User:
<span id="user-full-name"></span>
</p>
<script>
document.querySelector("button").addEventListener("click", () => {
fetch("/api/v1/users.json")
.then(resp => resp.json())
.then(user => {
document.querySelector("#user-full-name").innerText = user.fullName
})
})
</script>