The Ajax calls can also respond to specific status codes, not only a genral "success/failure" scheme.
If the server isn't available, you'll get nothing back, btw. ;)

Anyway, a possible and "clean" alternative is to use custom HTTP headers 
(Prototype already does this with support for a JSON header and Prototype version info).

You can access custom HTTP response headers by calling the getResponseHeader(name) method
on the Ajax response object you'll get for your Ajax.Request callbacks.

As mentioned, JSON (http://www.json.org/) support is built-in,

-Thomas

Am 29.06.2006 um 14:54 schrieb Martinez, Andrew:

1)       The Ajax operation was being used to send data to the server, the server would return a true/false value based upon that data that was computed server side.

(...)

Now, if we are in situation #1, is it really a good idea to use HTTP response failure headers, thus triggering the onFailure event, to signify an invalid computational value? Won’t we then lose the ability to tell if the serer is simply not present? I would imagine it would be better for the server to send response text back to the client that signifies a failure. Reserving error responses for situation 2, when we really need to know that the Ajax request isn’t being computed as a failure, it just isn’t reaching the server properly.

 

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to