MaxURL js XMLhttpRequest example - how do I detect internet connection error?
Hi!
I'm doing an XMLhttpRequest, using almost exactly the example given in the MaxURL help file. It is in a [js] object, and not using the explicit [maxURL] object.
This is for an installation, so I want to make it internet-proof, and I'm setting up a system for it to save data when there is no internet connection and upload it later.
The only problem is - as far as I can see - the error message that alerts you to there being no internet gets sent only to the Max window. I was wondering if there was something I could add to the function to indicate via an outlet in [js] that the request could not be made.
Thanks!!
Michael
First off its hard to tell without a patch and a response (the actual message you get from the url) but i would suggest looking for the HTTP-status codes. If i'm correct you're good if you get a "400"-response so i suggest using that as a filter.
Pseudo-code:
- send the request
- look for 400 in the response
- if its 400 do stuff
- if its not do other stuff...
Luvulongtime!
lol 400 is client-error, 200 is ok, search for 200! No connection is 0 (suprisingly)