Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

xhr.open() 404

Hi all,

I wonder if anyone knows how to check that the url that is passed to xhr.open is indeed an existing url.

this.responseText spits out the 404 but i have no idea how to deal with it

I need to check the reason why it isnt connecting to give the user some feedback (and also to close a view)

but no matter what I attempt it just will not process any further

[WARN] Error Domain=com.google.GDataXML Code=-1 
"Operation could not be completed. (com.google.GDataXML error -1.)". 
in -[TiDOMDocumentProxy parseString:] (TiDOMDocumentProxy.m:48)

any ideas are welcome, thanks in advance

— asked July 15th 2010 by Richie Mortimer
  • 404
  • ipad
  • responsetext
  • xhr.open

1 Answer

  • Accepted Answer

    Hi there,

    The HTTPClient request has a 'status' property that returns just the code you can check for (200, 404, 501, etc).

    You may want to put the subsequent (processing) code in an 'onload' - this only gets called if the response is successful.


    — answered July 15th 2010 by Chris Reed
    1 Comment
    • you are a star Chris, I didn't see status

      Thanks Mate

      — commented July 15th 2010 by Richie Mortimer
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.