Can Prototype or JQuery return an HTTP status code on an AJAX request

Posted by jotto on Stack Overflow See other posts from Stack Overflow or by jotto
Published on 2009-07-16T21:35:23Z Indexed on 2010/05/06 23:48 UTC
Read the original article Hit count: 142

Filed under:
|
|
|
|
url = "http://example.com"
new Ajax.Request(url, {
  onComplete: function(transport) {
    alert(transport.status);
  }
});

I'd like that to return a status of 200 if the site is working, or 500 if it is not working, etc.. But that code is returning 0 all the time.

Ultimately, I want to have a setinterval function that regularly pings a website for uptime status.

© Stack Overflow or respective owner

Related posts about prototype

Related posts about jQuery