Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
XMLHttpRequest Send() throws error despite onreadystatechange handler

I am using XmlhttpRequest to send a POST requests on localhost and chrome developer tools console and network to verify the requests.

I have two methods: Method1 send the post requests. Requesthandler handles the requests response.

When the request is successful (200) it does not throw an error and the request handler outputs a message on console. But when the request is unsuccessful. My console throws an error despite the request handler.

For example, If I purposely set the wrong url adress. I expect a 404 status Not Found exception and the request handler to output a message on console. Despite it happening, it still goes ahead and throws on the error on Send() Method.

Why xmlhttprequest.send() throws errors despite handling responses on the onreadystatechange event?

enter image description here

Method1(Sends Requests)

enter image description here

RequestHandler(Handles responses)

enter image description here

Console Message:

enter image description here

Thrown Error:

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!