website/js/customElements/skills.js

19 lines
615 B
JavaScript
Raw Normal View History

2021-11-18 06:57:23 +01:00
class Skill extends HTMLElement {
constructor() {
super();
2021-11-18 07:57:53 +01:00
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState == 4 && xhr.status == 200) {
JSON.parse(xhr.responseText).forEach(skill => {
const image = document.createElement("img");
image.src = "/API/getFile.php?filename=" + skill;
this.appendChild(image);
});
}
}
xhr.open("GET", "/API/skills.php");
xhr.send();
2021-11-18 06:57:23 +01:00
}
}
customElements.define("jl-skills", Skill);