There appears to be no reference back to Prototype's Ajax object, and even setting new properties in the XHR object is forbidden in IE as Tobie (I think) discovered when we tried to add a responseJSON property. There is a patch for wrapping the XHR object, which could contain a reference back to the Ajax object, but I don't know if it already does or what the status is on that. For now you'll have to declare the function elsewhere and reference it with a closure like Michael suggested or hack the Prototype source to pass an extra argument, but I strongly recommend against that.

Colin

michal wrote:
thanks thats a good idea and it works fine!
however, i am wondering if i would be able to invoke the onFailure
directly...

On 5 Apr., 16:58, Michael Peters <[EMAIL PROTECTED]> wrote:
  
michal wrote:
    
i wonder if its possible to call the onFailure-"method" within the
onSucces (see the commented line within the onSuccess method). i tried
      
this.onFailure(transport)
onFailure(transport)
      
Why not use a real function?

function my_failure(transport) {
  ...

}

new Ajax.Request(window.location.href, {
    method         : 'post',
    parameters     : params,
    requestHeaders : {Accept: 'application/json'},
    onSuccess      : function(transport) {
    if (!transport.responseText.startsWith('root'))
        my_failure(transport);
    },
    onFailure      : my_failure

});

--
Michael Peters
Developer
Plus Three, LP
    




  

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to