[jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-11 Thread Mr Speaker
In regard to the $.get and $.post error handling, I think that leaving $.get alone is fine - because there are still many cases when you can use it without being particularly worried about errors: like when pinging things, or for interactions where your are periodically updating something etc.

Re: [jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-11 Thread Nathan Bubna
Here's a really, really simple to fix $.ajax inconsistency that would sure help me out: http://dev.jquery.com/ticket/3591 :) On Mon, Nov 9, 2009 at 5:15 PM, John Resig jere...@gmail.com wrote: $.ajax is already one of the most complex and least consistent methods in jQuery, so if anything I'd

Re: [jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-11 Thread John Resig
Here's a really, really simple to fix $.ajax inconsistency that would sure help me out: http://dev.jquery.com/ticket/3591 Lucky for you then as that's already been fixed! :) --John -- You received this message because you are subscribed to the Google Groups jQuery Development group. To

Re: [jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-11 Thread Nathan Bubna
John, you rock. Thank you!! On Wed, Nov 11, 2009 at 12:37 PM, John Resig jere...@gmail.com wrote: Here's a really, really simple to fix $.ajax inconsistency that would sure help me out: http://dev.jquery.com/ticket/3591 Lucky for you then as that's already been fixed! :) --John --

[jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-10 Thread Dave Methvin
$.ajax is already one of the most complex and least consistent methods in jQuery, so if anything I'd like to see it get simpler. Can you expand on this? It'd probably be good to either document or fix the issues you're encountering. I think it's a result of the $.ajax method's very

Re: [jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-10 Thread John Resig
I think it's a result of the $.ajax method's very ambitious scope. The behavior can change quite a bit depending on the arguments, and many argument combinations aren't valid. http://docs.jquery.com/Ajax/jQuery.ajax#options Just a few examples: jsonp and cross-domain json/script requests

[jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-10 Thread Dave Methvin
$.get(url, callback).error( onError ) That creates a potential race condition, since the async request is made and may complete before the onError handler is attached. Is that really true? I thought javascript was strictly single threaded... That creates a potential race condition,

[jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread Markw65
On Nov 9, 7:29 am, John Resig jere...@gmail.com wrote: 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 I dont think thats true. There are

[jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread Jason Persampieri
I agree with pretty much everything Julian said. And while I don't have a problem with $.get(url, onSuccess, onError), I can see how this isn't jQuery-like. Right now, $.get returns an XmlHttpRequest object. What if that object were extended a bit? $.get(url, callback).error( onError ) Or,

Re: [jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread Julian Aubourg
Jason, I like what you're getting at.. a lot. 2009/11/9 Jason Persampieri papp...@gmail.com I agree with pretty much everything Julian said. And while I don't have a problem with $.get(url, onSuccess, onError), I can see how this isn't jQuery-like. Right now, $.get returns an

Re: [jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread John Resig
Jason, I like what you're getting at.. a lot. I agree, I like it as well. A completely different technique: jQuery(jQuery.get(url)).bind(success, fn); Then the jQuery.ajax method could call jQuery(xhr).trigger(success); Hmm. It'd be neat if we could somehow return just jQuery(xhr) but that's

Re: [jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread Julian Aubourg
Yeah, $.ajax already returning jQuery(xhr) would be awesome, but talk about backward compatibility breakage... the real question being: how many actually do use the xhr as a returned value (as opposed to beforeSend for instance). I have a question though... would

Re: [jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread Scott Sauyet
+1 Hmm. It'd be neat if we could somehow return just jQuery(xhr) but that's not really possible, not without breaking code, at least. It might just be possible, if jQuery(xhr) was then extended with the xhr API. I don't know if there is some overlap that would make this impossible, and I'm

[jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread Dave Methvin
Couldn't you just use the .ajaxError() method in conjunction with   $.get or $.post? That seems to work for me. I use that technique as well, and it's nice because it gets the error checking out of the way of the main code. I also have used a wrapper plugin around $.ajax in some cases. Neither

[jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread Dave Methvin
$.get(url, callback).error( onError ) That creates a potential race condition, since the async request is made and may complete before the onError handler is attached. -- You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group,

Re: [jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread Julian Aubourg
Just regarding the issue of jsonp, I'll ponit you to my own jsonp plugin: http://code.google.com/p/jquery-jsonp/ I too agree jsonp is a bit too specific for an inclusion within $.ajax but the proposed solution of returning a wrapper around the xhr could help smoothing out differences. Regarding

[jquery-dev] Re: Calling callback in $.post $.get on error

2009-11-09 Thread Markw65
On Nov 9, 4:31 pm, Dave Methvin dave.meth...@gmail.com wrote: $.get(url, callback).error( onError ) That creates a potential race condition, since the async request is made and may complete before the onError handler is attached. Is that really true? I thought javascript was strictly single