I’m working on Wikipedia Viewer and I’m making XMLHttpRequest to get data from Wikipedia API, but I’m getting this error:
XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?action=opensearch&search=donald%20trump&format=json&callback=?. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.
Could someone explain to me how to set header and what it should look like and why?
I know that it would probably be easier to use jQuery for this but I want to make this with pure JS if possible.