Re: [jquery-dev] aborting Ajax calls the success callback

2010-01-16 Thread John Resig
It's not really clear what it should call - maybe it should only call
the complete request and neither the error or success. When I looked
into it recently some browsers called success and some called nothing
(Opera). I normalized it to success across the board but I'm open to
further debate.

--John



On Sat, Jan 16, 2010 at 7:47 PM, alexander farkas
a.farkas...@googlemail.com wrote:
 Is it intended, that aborting an Ajax will call the complete calback
 with the status success + the success-callback? In most cases noone
 wants to handle an aborted request in his success-callback. I think,
 you should introduce a new xhr-event/callback 'abort'.

 --
 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.




-- 
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.




Re: [jquery-dev] aborting Ajax calls the success callback

2010-01-16 Thread Daniel Friesen
Isn't that a loose use of the term success originating in confusion 
caused by abstraction?


We call it success because that's it's a word describing what we 
expect it to do. The browser's actual xhr has no concept of success on 
it's own, that is determined by the library/application based on 
completion, http error codes, etc... The real success we are firing 
that method in jQuery on to xhr is actually the concept of completion of 
the xhr call, coupled with a non-fatal status code. The browser ends up 
firing success because by calling abort we cancel all the remote 
interaction and bring it to it's finished state, hence it is complete. 
readyState == 4 is really DONE, not success, it's an indication that 
the xhr has been opened and whether it succeeded, failed, or aborted the 
request is over and is no longer doing anything.


I think calling error: with a statusText of abort would be the more 
intuitive way of handling this.


~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

John Resig wrote:

It's not really clear what it should call - maybe it should only call
the complete request and neither the error or success. When I looked
into it recently some browsers called success and some called nothing
(Opera). I normalized it to success across the board but I'm open to
further debate.

--John



On Sat, Jan 16, 2010 at 7:47 PM, alexander farkas
a.farkas...@googlemail.com wrote:
  

Is it intended, that aborting an Ajax will call the complete calback
with the status success + the success-callback? In most cases noone
wants to handle an aborted request in his success-callback. I think,
you should introduce a new xhr-event/callback 'abort'.

--
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.





-- 
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.