How do I get the HTML status code with jQuery?

Posted by cvack on Stack Overflow See other posts from Stack Overflow or by cvack
Published on 2010-06-02T08:09:26Z Indexed on 2010/06/02 8:13 UTC
Read the original article Hit count: 220

I want to check if a page returns the status code 401. Is this possible?

Here is my try, but it only returns 0.

$.ajax({
    url: "http://my-ip/test/test.php",
    data: {},
    complete: function(xhr, statusText){
    alert(xhr.status); 
    }
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX