Christos Tsamis7,983 Points
has been blocked by CORS policy
Code is right, debuged it and and faced a CORS policy problem.. Any ideas?
My suggestion would be that if you use Visual Studio Code to use the Live Server extension, that should fix your problems.
This is actually a really common frustration for developers and likely has nothing to do with your code: As a security feature, Chrome does not allow "cross-origin resource sharing" when you're working on localhost or just using File>Open to load a webpage locally. There are a few work-arounds, the best of which might be to run a local server with a domain alias -- but I understand that's asking a lot if you've never done it and just want to do this one thing. I personally would not suggest setting any flags
--disable-web-security that would compromise your browser. Here's some discussion about it: https://stackoverflow.com/questions/10883211/deadly-cors-when-http-localhost-is-the-origin.