brahmakumarisUS
06-12-2022
10:05 AM
Thread Options
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
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.
Reply
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
0 REPLIES 0