Nick Vanderbilt
Nick Vanderbilt

Reputation: 38540

jQuery error callback on ajax call if server is down

I am using jQuery and I am making AJAX request from the many methods available to me. I am testing error callback condition and so far so good.

If I bring the server down then firebug shows the request in RED which means it was an error. However error callback is not getting called. Is this expected ? Or should jQuery's error callback should be invoked when server is disconnected.

If the expected behavior is that jQuery's error callback will not be called then how will you notify users that server is down?

Upvotes: 3

Views: 506

Answers (1)

Byron Whitlock
Byron Whitlock

Reputation: 53921

You use the timeout. You don't know if the server is down, only if it doesn't respond.

Upvotes: 1

Related Questions