x

Fetching API Data failed due to CORS error

Unable to fetch the data using the javascript fetch api can some one please help, html code is posted below:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0">
    <title>JavaScript | fetch() Method</title>
</head>
<body>
    <script>
        // API for get requests
        let fetchRes = fetch(
"https://murli.brahmakumaris.org/iservices/api.do?action=addressList&cid=182");
        // fetchRes is the promise to resolve
        // it by using.then() method
        fetchRes.then(res =>
            res.json()).then(d => {
                console.log(d)
            })
    </script>
</body>
</html>

Error in console: Access to fetch at 'https://murli.brahmakumaris.org/iservices/api.do?action=addressList&cid=182' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Any help is appreciated.

446 Views
Message 1 of 1
Report
0 REPLIES 0