Answer the question
In order to leave comments, you need to log in
How to pull xml or json into js from the same directory?
Good day. The question seems to be insanely simple, but managed to drive me into a dead end.
There is a gitlab project - ala tests for students. The bottom line is that questions and answers are stored in an xml or json file, and when choosing a test, the corresponding questions are loaded. When trying to implement methods for loading an xml or json file into the js code, the console threw an error about violation of the CORS policy, which, in principle, is both logical and not. The json file itself is in the same directory as the .js file
. Can you please tell me how to fix this? Maybe there are some methods other than raising the server?
Answer the question
In order to leave comments, you need to log in
There are no directories on the Internet. there is a URI or a special case of a URL (http / https)
since the question does not have a NODE.JS tag, I assume by default that javascript is executed on the computer of the website visitor, and the files are hosted.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question