What is difference between xhr.status and xhr.readyState?

by kamryn.gulgowski , in category: Technology , 3 months ago

What is difference between xhr.status and xhr.readyState?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by graciela.bogisich , 3 months ago
  • xhr.status: used to determine whether the request was successful or not.
  • xhr.readyState: the state of the request'
  • xhr.readyState zero(0) means "has not yet been sent"
  • xhr.readyState zero(4) means "complete and response received"

The server provides the status, while the user agent provides the readyState.