Great, but is it safe when using multiple Request?

On 22 mar, 14:18, Michael Peters <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Is it possible with the Ajax object to pass extra parameters that will
> > be accessible on the success callback?
>
> > Like a responseParameters parameter or something like that?:
>
> Just use a closure. This means declaring the var before the anonymous function
> (the onSuccess callback, or any other callback for that matter) and it will be
> visible in that anonymous function.
>
> > new Ajax.Request(url,
> >   {
> >     method:'get',
> >     onSuccess: function(transport){
>
> >          /*
> >           * Here I have some variable or function instance to call...
> >           */
> >      functionName();
> >      alert(responseParameters.params[0]);
>
> >     },
> >    responseParameters = new Array('stuff1', functionName, 'etc...')
> >   });
>
> var responseParameters = ['stuff1', functionName, 'foo'];
> new Ajax.Request(url,
>   {
>     method : 'get',
>     onSuccess : function(transport) {
>       // call functionName()
>       responseParameters[1]();
>     }
>   }
> );
>
> --
> 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