I would like to add my opinion. I strongly believe that 204 is a success condition and should end up calling the success callback with null for data (or possibly an empty object {} if that would cause less backward compatibility problems) and the actual status (in this case 204).
Parsererror is not the right status since there was nothing to parse. The success callback has the status code and can make any decisions it needs to based on it. I think that viewing success from the protocol is the correct perspective. So what if the ajax call said it would accept application/ json that just means that if there is a response that is the format I would like it in. It REST it is very reasonable for a resource to return 204. It may also return other status such as 200 if there is data to return. So the REST client needs to be ready for either *success* case. As it currently stands I need to have checking in the error call back to convert the "error" to success for the next layer up, which seems ugly to me. As someone pointed out all status codes 2xx, 3xx are success. Not sure 3xx status codes apply - doesn't XHR follow redirects on its own? Most 3xx cases are handled by XHR internally and the ones that are not are already handled by jQuery. Anyway I agree that all 2xx, 3xx cases should call the success callback. I do not think individual callbacks for each status code are a good idea. Thanks, -John On Jul 24, 5:09 am, Nick Fitzsimons <n...@nickfitz.co.uk> wrote: > 2009/7/23 John Resig <jere...@gmail.com>: > > > I guess that's a tangential issue, not really related to JSON - if a server > > returns a204(with no content) should we call success with a null or > > undefined data argument? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---