aborting Ajax calls the success callback

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

aborting Ajax calls the success callback

alexander farkas
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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: aborting Ajax calls the success callback

John Resig
Administrator
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
<[hidden email]> 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 [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> 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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: aborting Ajax calls the success callback

alexander farkas
I think, it should only call complete and the status message should be
"abort" (or the readyState property is always 0).

In most cases abort is used to cancel the request and the default
handling/succes handling, because the request became unneeded. An
error doesn´t fit, either. This would make problems with error-
handling.

Abort is a totally new even-type, so that we need a way to distinguish
between abort and the other complete/stop events.

On 17 Jan., 02:48, John Resig <[hidden email]> 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
>
> <[hidden email]> 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 [hidden email].
> > To unsubscribe from this group, send email to [hidden email].
> > For more options, visit this group athttp://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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: aborting Ajax calls the success callback

Daniel Friesen-2
In reply to this post by John Resig
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
> <[hidden email]> 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 [hidden email].
>> To unsubscribe from this group, send email to [hidden email].
>> 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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: aborting Ajax calls the success callback

jaubourg
I implemented it exactly as Daniel described in the rewrite and I do believe it's the most logical thing to do.

2010/1/17 Daniel Friesen <[hidden email]>
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.pm@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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: aborting Ajax calls the success callback

alexander farkas
In reply to this post by Daniel Friesen-2

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

Sorry, why should you want to handle abort the same way you handle an
error? If you intentional abort a request, it stops/completes, but i
don´t see an error in this. Why not simply use the complete event/
callback with status "abort".

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: aborting Ajax calls the success callback

homm
In reply to this post by alexander farkas
I agree with alexander farkas. When I get success, I expect full
response in data parameter. What need I do with half of XML? Or, where
can I insert cut of html? This data is unnecessary for me in success-
callback.

On 17 янв, 05:47, alexander farkas <[hidden email]> wrote:
> Is it intended, thatabortinganAjaxwill 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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.