CORS header Access-Control-Allow-Origin missing

I am getting a CORS error when trying to load data from certain websites.
Eg.
states =(await fetch(“https://rte.socialcops.org/assets/maps/indiaStates.json”)).json()

This raises the error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://rte.socialcops.org/assets/maps/indiaStates.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Why is this happening only with certain websites and not with the ones in the examples?

Also, if anyone could suggest a way to load data in from a local server that would be very helpful.

Just read this. Sorry, for not reading the docs first.