Well, to be honest, I never ever use $.get or $.put (or $.getJSON). The main reason is that there is no error callback which, in my opinion, makes them completely useless in any production environment.
Now I understand the convention being broken argument, but the two callback solution: - does not break current code, ever, - does not necessitate jQuery to create a special error callback that will redirect to the dual callback function, - does not necessitate branching in user code. I dunno, but for helper functions, I'd be willing to sacrifice some api purity and have them really useful yet backward compatible. But, then again, I never had the responsibility of anything that's became as huge as jQuery, so... 2009/11/9 John Resig <jere...@gmail.com> > > Wouldn't it still break some scripts that actually expect the data never > to > > be undefined? > > As I mentioned before - the application would just break in a > different way. Normally it would break in that the result would never > come in - now it would throw an exception (again, that's assuming that > if they're trying to do something directly with the object - a more > likely result is seeing "null" outputted somewhere). > > > Why not the following: > > > > $.get("someurl", function(data) { > > // got results > > }, function(errorMessage) { > > // got error > > }); > > > > That way, actual scripts behave as usual and new ones can provide an > error > > callback. > > > > Thoughts? > > I'm not a huge fan of this - having dual functions being passed in as > arguments is messy and against the current jQuery conventions. I feel > like if you're passing in so many functions why not just use $.ajax > and be done with it? Especially since $.ajax is so much more explicit > any way. > > Either we should find a simple solution (like what I proposed) or do > no change at all. > > --John > > -- > > You received this message because you are subscribed to the Google Groups > "jQuery Development" group. > To post to this group, send email to jquery-...@googlegroups.com. > To unsubscribe from this group, send email to > jquery-dev+unsubscr...@googlegroups.com<jquery-dev%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/jquery-dev?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@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.