XMLHttpRequest Demo: Setting timeouts

In this example, we have a script on the server that will take 5 seconds to return a JSON file. We have set a timeout of 3 seconds, after which a timeout event will be fired.

If your browser supports XHR timeouts, the timeout event handler will:

Otherwise, you will see the data after it has been parsed.

Results