-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

        I have a question, perhaps a bit newbie-ish, but I think it's important
nonetheless.  What is the proper way to handle errors reported by
back-end processes via Ajax?  For instance, let's take a very simple
Ajax.Request call like this :

new Ajax.Request('delete_item.php',
                 {
                 method: 'post',
                 parameters: {action: 'delete', id: myId},
                 onSuccess: function() {
                               alert('success');
                            },
                 onFailure: function() {
                               alert('failure');
                            }
                 });

Ok, simple enough.  Obviously the HTTP error codes are handled here,
albeit a bit generically.  What about a non-HTTP error?  What if, for
instance, myId was invalid?  What is the proper way to pass that
information back to the ajax application?  Is it ok to use a custom 4xx
error?  Or should I be using JSON or XML to handle this?

Thanks!

- -- 
- ---------------------------
Jason 'XenoPhage' Frisvold
xenoph...@godshell.com
- ---------------------------
"Any sufficiently advanced magic is indistinguishable from technology."
- - Niven's Inverse of Clarke's Third Law
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkwf0l4ACgkQ8CjzPZyTUTRhOgCfUDsRAQQ/gcht2ruJLLyuqZ2g
fHYAn01hvmtIuHDMZbQK1Hv2YpXDkUVp
=5h5F
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to