When Communication Breaks Down

When a web browser contacts a webserver for information, many things can go wrong. Here are some examples:

  • The page being requested may not actually be on the server.

  • The user may not have permission to access the page.

  • If a server-side program is being called, something might go wrong with that program.

  • The server might take too long to get back to the web browser, and the browser might stop waiting.

When a request object sends a request and then says that the request has been fulfilled (its readyState is 4), all we really know is that the request has been answered in some way. Everything could have gone well, with the server sending the information requested, or something may have gone wrong.

To determine how the client-server ...

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.