I'm sending requests for JSON data and would like to know the best way 
to test for a successful response.

I'm sending this:

req = new qx.io.remote.Request(url, qx.net.Http.METHOD_POST, 
qx.util.Mime.JSON)

and on successful server response using:

reqCompleted : function(e) {
    result = e.getContent()
    ...

If the call was successful (no server errors), I can get results in the 
following way:

someVar = result['someVar']

If there was a server error and the response wasn't parsable as JSON, I 
would find that someVar is empty, but its type would be reported as XML. 
I'm currently testing for failure by checking the type of a variable 
that should be returned:

if(typeof(result['someVar']) != "boolean") {
  alert(result)

I assume there is a much better way to do this.


David

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to