For what it's worth, `undefined` is an illegal JSON value. You could
pass undefined rather than null or an empty object because json ===
undefined would mean that the json failed since `undefined` is not a
legal json value like `null` and `{}` are.

On Jul 23, 6:33 am, Dave Methvin <dave.meth...@gmail.com> wrote:
> > But following that argumentation a 204 would always be an error
> > since any request expects something (XML by default), no?
>
> Well, yeah I guess, except the situation where you were asking for
> html or text and it could be returned as an empty string on a 204. I
> want to define "error" and "success" in terms of whether it
> successfully delivered the dataType requested, not the underlying http
> status code that delivered it.
>
> For example, let's say I request dataType:jsonand the server returns
> 200 but content that is not validjson. Somehow, $.ajax needs to let
> me know about that. If it fires the success handler, what should 
> thejsonargument be? If it's an empty object or null, it doesn't capture
> the fact there was an error. I won't have any indication that there
> was a problem unless I try re-parsing the responseText myself.
>
> In the 204+jsoncase you could certainly pass a null or empty object
> to the success handler instead of firing the error handler, although
> I'd prefer to have it fire an error. Alternate interpretations can
> always be dealt with by using complete instead of error/success so
> this seems like an issue of picking the interpretation with the least
> surprise.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to