CORS-Error-Solution-main

PHOTO EMBED

Thu Aug 01 2024 19:51:38 GMT+0000 (Coordinated Universal Time)

Saved by @Bh@e_LoG

function solve(){
    const xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
        document.getElementById("data").innerHTML = xhttp.responseText;
        }
    };
    xhttp.open("GET", "https://cors-anywhere.herokuapp.com/https://tiny-news-api.herokuapp.com/api/news", true);
    xhttp.send();
}
solve()
content_copyCOPY

https://github.com/ahmetkabacali/CORS-Error-Solution-main/blob/main/main.js