> (It seems to me as though the form always returns 'successful' code ?)
If the HTTP request is successful then the success function is invoked. This is no different than using jQuery's $.ajax function. A request is deemed to be successful it the server response has a statusCode of 2xx or 304. You could choose to set an error status code to drive the desired client behavior or you could return a 200 status with content in the response body. That content would then be passed to your success callback and you could interrogate it as needed.