+ 3
problem with HTTP requests in the code playground
I'm trying to use the API from another site in a program in the code playground. The XMLHttpRequest only reaches a readyState of 1, meaning a server connection was established, but doesn't go any further. Is this specific to SoloLearn or am I most likely just making a mistake?
5 Answers
+ 9
i assume the problematic code is the one in your codes list?
here's a modified version
https://code.sololearn.com/WqQw5Q8RnqFk/?ref=app
+ 10
wasn't CORS (well it was actually, but dealt with it with the cors-anywhere API)
main problem was not creating a listener to handle the response
here's some stuff to read @Ashley
XMLHttpRequest MDN:
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest
cors-anywhere:
https://github.com/Rob--W/cors-anywhere/blob/master/README.md
end point for making requests
https://cors-anywhere.herokuapp.com/<your requested url>
+ 2
Maybe CORS protection. Could you share your code here?
+ 2
yep, it's the one in my code list. Thanks @Burey!
0
nice code:)