Re: Re: onComplete: handleSuccess - What gets passed?

Alex Duffield
Sat, 05 Aug 2006 15:55:43 -0000

Eric, thanks for the answer. I was hoping to be able to get the
options (parameters in particular)  that where used in the origian
request. Oh well. Ill find another solution.


______________________________________________________________________
Alex Duffield . Principal . InControl Solutions . http://
www.incontrolsolutions.com



On 5-Aug-06, at 8:23 AM, Eric Anderson wrote:

> Alex Duffield wrote:
>> I am curious what gets passed back from an completed Ajax.Request
>> call?
>
> All of the Ajax.Request event handlers receive two arguments. The
> first is the XMLHttpRequest object used to make the Ajax request.
> This is often referred to as the transport in the Prototype
> library. You can find details about this object at:
>
> http://en.wikipedia.org/wiki/XMLHttpRequest
>
> The second argument passed in is a JavaScript data structure
> created from a JSON string. This JSON string is received from the X-
> JSON header in the HTTP response for your Ajax call.
>
> Finally, all event handlers for the Ajax.Request object are
> executed in the context of the Ajax.Request object. That means that
> the "this" identifier can be used to query the Ajax.Request
object
> that made the request.
>
> There is one exception to what I just stated. The onException
> callback just receives one argument which is the exception that was
> generated.
>
>> I am using "onComplete: handleSuccess" in my request:
>
> You may want to consider using onSuccess instead of onComplete.
> onComplete executes when the XMLHttpRequest object has completed
> the request but that request is not necessarily successful. For
> example it could have received a 404 response and still called
> onComplete. When you use onSuccess your callback will only be
> executed when you get back a successful response from the
> webserver. You can use onFailure to detect problems such as 404
> responses.
>
> Eric
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs