Trying to get a value from my server - throws a CORS error


I have a server with functions I created and one of them is to get a key. When I try to access it and put that in a variable, it throws this error:

Access to XMLHttpRequest at 'link to URL has been removed' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I changed the URL above - but why am I getting an error like that?

The variable webURL has the direct URL of the function that allows for a GET (it produces a key).

The following works but no text is actually in the variable:

webURL = "direct URL to the function on my server"
GetJSON(webURL, newPublicKey)

The message box is empty.

Why is this happening?



You’re running into Same Origin Policy, an important part of the internet:

The best way around this is to load your app from the same server you are getting the data from.