You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2 KiB

<script src="jquery-3.5.1.min.js"></script>
<script>
function stahniJSON() {
$.getJSON("/data.json")
.done(function(data) {
console.log(data);
let div = $("#obrazek")
let p = $("#text")
for (let index = 0; index < data.symboly.length; index++) {
const tx = text[index];
p.append("<label>" + tx + "</label>")
}
for (let index = 0; index < data.symboly.length; index++) {
const obr = obrazek[index];
div.append("<img src='images/" + obr + "' >")
}
})
.fail(function() {
console.log("chyba");
alert("Chyba se řeší")
})
.always(function() {
console.log("Vždycky")
});
}
</script>
"obrazek_s": [
"image_01.jpg",
"image_02.jpg",
"image_03.jpg"
],
"text_s": [
"Toto je textová informace 1",
"Toto je textová informace 2",
"Toto je textová informace 3"
]