Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.getElementById('input').addEventListener('click', function(event) {
- event.preventDefault();
- fetch(API_URL)
- .then(result => {
- if (!result.ok) {
- throw new Error('Non 200 status');
- }
- return result.json();
- })
- .then(data => console.log(data))
- .catch(error => console.error(error));
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement