script error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

script error

I wrote a code https://code.sololearn.com/WHdHzHUvyF1C/#js It works, but always adds a script error. Why? What should I do? Thanks! LuMA

29th Sep 2019, 4:55 AM
LuMa
LuMa - avatar
3 Answers
+ 2
You're welcome 😄
30th Sep 2019, 2:19 PM
Ryan
Ryan - avatar
+ 1
All you have to do is check for readyState and status properties. For instance: Http.onreadystatechange = () -> { If (Http.readyState === 4 && Http.status === 200) { // Your code goes here. } else { // Error handling code goes here. } } For a more in-depth guide please checkout this link: https://www.w3schools.com/js/js_ajax_http_response.asp
29th Sep 2019, 6:39 PM
Ryan
Ryan - avatar
+ 1
Thank you, Xianort! Now, I got back 2 and 3 Http.readyState. Http.status is 200.
30th Sep 2019, 2:10 PM
LuMa
LuMa - avatar