Created
May 15, 2020 06:38
-
-
Save PriitParmakson/4f6c07b116baa37708dd67d6e399fb31 to your computer and use it in GitHub Desktop.
Fetch kasutamine
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
fetch(url) | |
.then(res => res.json()) | |
.then((data) => { | |
// $('#Tulemus').text(JSON.stringify(data, null, 4)); | |
if (data.status == "success") { | |
kuvaAndmed(data); | |
} else { | |
$('#Teade').text('Andmepäring ebaõnnestus'); | |
} | |
}).catch(err => { | |
$('#Teade').text('Andmepäring ebaõnnestus'); | |
console.error(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment