-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ilta Riikonen
committed
Dec 8, 2024
1 parent
1e773a8
commit 18b6a9f
Showing
6 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
</a> | ||
</div> | ||
|
||
<div id="sisalto"></div> | ||
<div id="vastaus"></div> | ||
|
||
<script> | ||
function myFunction() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
</a> | ||
</div> | ||
|
||
<div id="sisalto"></div> | ||
<div id="vastaus"></div> | ||
|
||
<script> | ||
function myFunction() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
</a> | ||
</div> | ||
|
||
<div id="sisalto"></div> | ||
<div id="vastaus"></div> | ||
|
||
<script> | ||
function myFunction() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
fetch("https://api.visittampere.com/api/v1/visittampere/event/all/") | ||
.then(function(response) { | ||
return response.json(); | ||
}) | ||
.then(function(responseJson) { | ||
kerro(responseJson); | ||
}) | ||
.catch(function(error) { | ||
document.getElementById("vastaus").innerHTML = | ||
"<p>Tietoa ei pystytä hakemaan</p>"; | ||
}); | ||
|
||
function kerro(data) { | ||
let teksti = "<h1>Tampereella tapahtuu</h1>"; | ||
data.forEach(t => { | ||
let tiedot = t.pirkanmaaevents_event; | ||
let linkki = tiedot.provider_link; | ||
|
||
teksti += "<h3>" + tiedot.name[1].text +"</h3>"; | ||
teksti += "<p>" + tiedot.description[1].text +"</p>"; | ||
if (linkki != "") { | ||
teksti += "<p><a href=" + linkki + ">" + linkki + "</a></p>"; | ||
} | ||
}); | ||
document.getElementById("vastaus").innerHTML = teksti; | ||
} |