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
3 ответов
+ 2
You're welcome 😄
+ 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
+ 1
Thank you, Xianort!
Now, I got back 2 and 3 Http.readyState. Http.status is 200.