Home > Uncategorized > Ajax HTTP status code 0 (zero)

Ajax HTTP status code 0 (zero)

I find that when I encounter a HTTP status code of 0 when using Ajax, it means there is some network error between the client and server, for example, a firewall issue, a network failure, or such forth.

The type of issue was spotted in code that looks like this;

$.get(“http://www.somedomain.com/yourajax.aspx”,function(data){
// Success case
}).fail(function(xhr,status){
if (xhr.status == 0)
{
// Network problem?
}
});

Of course, this is only likely to occur in cross-domain ajax, since it is unlikely for a server to serve a page, and then immediately become unreachable to ajax.

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: