skip to Main Content

Does Javascript’s Fetch catch errors?

I am learning JavaScript api project, fetch, then, catch . I coded along with a YouTube JavaScript api project. Every time I try it, 'catch' is not working. let searchBtn=document.getElementById("search-btn"); let countryInp=document.getElementById("country-inp"); searchBtn.addEventListener("click", ()=>{ let countryName=countryInp.value; let finalURL=`https://restcountries.com/v3.1/name/${countryName}?fullText=true`; console.log(finalURL); fetch(finalURL)…

VIEW QUESTION

Reactjs – CORS blocking fetch

Im trying to do a fetch request to an open API: https://www.tenderned.nl/papi/tenderned-rs-tns/v2/publicaties/298340/documenten, but when i try this, i get the following error that CORS is blocking my fetch: Ive already tried the following fixes found on the internet: Adding an…

VIEW QUESTION
Back To Top
Search